From 4ff41e6ff86b3f6a3a0ba215e9a3c8be19cf8055 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Fri, 8 Jan 2021 17:27:12 +0200 Subject: [PATCH] Remove useless call in QProcessPrivate::waitForFinished() on Windows if pid == nullptr, the child process has already exited and the pipe readers have been stopped. So the call to drainOutputPipes() is unnecessary here. Change-Id: I0bed90d08ac879bb0ae178a1cdc37afb9d825314 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_win.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 2a5b8fd4fd5..e65d4683be8 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -776,10 +776,8 @@ bool QProcessPrivate::waitForFinished(const QDeadlineTimer &deadline) if (stderrChannel.reader && stderrChannel.reader->waitForReadyRead(0)) timer.resetIncrements(); - if (!pid) { - drainOutputPipes(); + if (!pid) return true; - } if (WaitForSingleObject(pid->hProcess, timer.nextSleepTime()) == WAIT_OBJECT_0) { drainOutputPipes();