path: root/src
diff options
authorJoerg Bornemann <>2015-02-04 15:12:36 +0100
committerJoerg Bornemann <>2015-02-05 13:43:57 +0000
commitdf3ffeec15cd20c249cb6ffb2d235526a05722a5 (patch)
treeab644e1faa99f1bd74feab140d7500b63e91666a /src
parent6a607aa7aa56ddf4323aa78d64925192494befb8 (diff)
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 <> Reviewed-by: Oswald Buddenhagen <>
Diffstat (limited to 'src')
2 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index a234050777..939cecfb44 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1044,9 +1044,9 @@ bool QProcessPrivate::_q_processDied()
return false;
#ifdef Q_OS_WIN
- drainOutputPipes();
if (processFinishedNotifier)
+ drainOutputPipes();
// the process may have died before it got a chance to report that it was
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index ee6b7e13f4..9e60daa5b4 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -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