Details
Description
I have found a problem that randomly happens. It's subbtle but the fix is easy. This is related to QProcess.
When ending a process, Qt does some cleanup, and among others, the following code is executed:
QWindowsPipeWriter::~QWindowsPipeWriter() { lock.lock(); quitNow = true; waitCondition.wakeOne(); lock.unlock(); if (!wait(100)) terminate(); #if !defined(Q_OS_WINCE) || (_WIN32_WCE >= 0x600) CloseHandle(writePipe); #endif }
This is in file "qwindowspipewriter.cpp". The code is ok but wait(100) is not enough. Most of the time 100 ms is enough, but sometimes this is not. In that case terminate() is called (this is a thread), which is not the recommanded way to end a thread. And in my case this has very bad side-effects!!!
I don't have the problem if I set wait(1000) instead of wait(100).
I suggest that you do this change. Relying on a 100 ms timeout is certainly not a good choice when an application is running heavily!
Attachments
For Gerrit Dashboard: QTBUG-4425 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
17395,2 | QWindowsPipeWriter could terminate the process to early | master | qt/qtbase | Status: MERGED | +2 | 0 |
17766,1 | QWindowsPipeWriter could terminate the process to early | api_changes | qt/qtbase | Status: ABANDONED | 0 | 0 |
17923,1 | QWindowsPipeWriter could terminate the process to early | 4.8 | qt/qt | Status: MERGED | +2 | 0 |