From 5d6dbc66370cfd66a2613e8668415e2adc254b24 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 18 Jul 2013 11:22:17 +0200 Subject: fix endless loop in QProcess/Win drainOutputPipes Commit 568f82fba397e06a26b4fd40f074e4432d02d248 was incomplete. If drainOutputPipes detected some readyRead it wouldn't end the loop. Task-number: QTBUG-32354 Change-Id: I4e594f1e148abe9ef36c047a55eee1b22fd5064b Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_win.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index bcc3fe0b0d..f16025752e 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -630,8 +630,9 @@ bool QProcessPrivate::drainOutputPipes() if (!stdoutReader && !stderrReader) return false; - bool readyReadEmitted = false; + bool someReadyReadEmitted = false; forever { + bool readyReadEmitted = false; bool readOperationActive = false; if (stdoutReader) { readyReadEmitted |= stdoutReader->waitForReadyRead(0); @@ -641,12 +642,13 @@ bool QProcessPrivate::drainOutputPipes() readyReadEmitted |= stderrReader->waitForReadyRead(0); readOperationActive |= stderrReader->isReadOperationActive(); } + someReadyReadEmitted |= readyReadEmitted; if (!readOperationActive || !readyReadEmitted) break; Sleep(100); } - return readyReadEmitted; + return someReadyReadEmitted; } bool QProcessPrivate::waitForReadyRead(int msecs) -- cgit v1.2.3