QProcess/Win: fix crash in drainOutputPipes

stdoutReader->waitForReadyRead() can synchronously trigger the
deletion of stdoutreader (via signal readyRead(),
_q_canReadStandardOutput(), destroyChannel()).
Analoguous for stderrReader.

Task-number: QTBUG-33730

Change-Id: I8badac53e92a979c437838b2959b4c0445c8de81
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Joerg Bornemann 2013-10-01 11:03:32 +02:00 committed by The Qt Project
parent 5ad1e2578b
commit 8dc8fe53f9

View File

@ -654,11 +654,11 @@ bool QProcessPrivate::drainOutputPipes()
bool readOperationActive = false;
if (stdoutReader) {
readyReadEmitted |= stdoutReader->waitForReadyRead(0);
readOperationActive = stdoutReader->isReadOperationActive();
readOperationActive = stdoutReader && stdoutReader->isReadOperationActive();
}
if (stderrReader) {
readyReadEmitted |= stderrReader->waitForReadyRead(0);
readOperationActive |= stderrReader->isReadOperationActive();
readOperationActive |= stderrReader && stderrReader->isReadOperationActive();
}
someReadyReadEmitted |= readyReadEmitted;
if (!readOperationActive || !readyReadEmitted)