From 25723504d1fc917671dbdeadf441c2ca12145297 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 3 Mar 2011 15:33:04 +0200 Subject: Fix QProcess::waitForFinished WaitForRequest handling in Symbian Waiting for both logonStatus and timerStatus after one has already completed normally could potentially return because some unrelated request completed in the meantime, swallowing the wrong signal. Task-number: QT-4659 Reviewed-by: Janne Koskinen --- src/corelib/io/qprocess_symbian.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index d22d1ed..8a74c7b 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -961,16 +961,15 @@ bool QProcessPrivate::waitForFinished(int msecs) User::WaitForRequest(logonStatus, timerStatus); QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed"); - if (timerStatus == KErrNone) + if (logonStatus != KRequestPending) { + timer.Cancel(); + User::WaitForRequest(timerStatus); + } else { timeoutOccurred = true; - - timer.Cancel(); + symbianProcess->LogonCancel(logonStatus); + User::WaitForRequest(logonStatus); + } timer.Close(); - - symbianProcess->LogonCancel(logonStatus); - - // Eat cancel request completion so that it won't mess up main thread scheduling later - User::WaitForRequest(logonStatus, timerStatus); } } else { QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished(), qt_rprocess_running returned false"); -- cgit v0.12