summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2013-07-03 16:10:31 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-05 13:37:22 +0200
commit568f82fba397e06a26b4fd40f074e4432d02d248 (patch)
treebdf6cb5aaa491e97f441055d4db6d7b5d9f45738 /src/corelib/io
parentee73f7b7db91f6ba32300cb6c16978371012cfb9 (diff)
fix infinite loop in QProcessPrivate::drainOutputPipes
When drainOutputPipes is called, the process is already dead. If readyReadEmitted is false, there was no data in the pipes. As the process is dead, there won't be data in the pipes in future iterations. The situation that triggered the infinite loop was this: process A starts console process B. B starts console process C. C inherits stdout/err of B. B dies. C runs forever and does not close the stdout/err handles. A notices that B died and calls drainOutputPipes. Task-number: QTBUG-29391 Change-Id: I4819901df307be684c6ad70753a5f964a834704a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qprocess_win.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 7776852277..bcc3fe0b0d 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -641,7 +641,7 @@ bool QProcessPrivate::drainOutputPipes()
readyReadEmitted |= stderrReader->waitForReadyRead(0);
readOperationActive |= stderrReader->isReadOperationActive();
}
- if (!readOperationActive)
+ if (!readOperationActive || !readyReadEmitted)
break;
Sleep(100);
}