QProcess/Win: fix sporadic crash
QProcessPrivate::_q_processDied() was potentially called twice if there was a slot connected to readyRead() that called processEvents(), because the processFinishedNotifier was still enabled when readyRead() was emitted. This led to a null pointer access in findExitCode. Change-Id: I4b796b81f050dc46bb9469602984accaa6ebfa28 Task-number: QTBUG-33731 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>bb10
parent
6a607aa7aa
commit
df3ffeec15
|
|
@ -1044,9 +1044,9 @@ bool QProcessPrivate::_q_processDied()
|
|||
return false;
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
drainOutputPipes();
|
||||
if (processFinishedNotifier)
|
||||
processFinishedNotifier->setEnabled(false);
|
||||
drainOutputPipes();
|
||||
#endif
|
||||
|
||||
// the process may have died before it got a chance to report that it was
|
||||
|
|
|
|||
|
|
@ -785,6 +785,7 @@ bool QProcessPrivate::waitForFinished(int msecs)
|
|||
void QProcessPrivate::findExitCode()
|
||||
{
|
||||
DWORD theExitCode;
|
||||
Q_ASSERT(pid);
|
||||
if (GetExitCodeProcess(pid->hProcess, &theExitCode)) {
|
||||
exitCode = theExitCode;
|
||||
crashed = (exitCode == 0xf291 // our magic number, see killProcess
|
||||
|
|
|
|||
Loading…
Reference in New Issue