summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2010-02-01 10:51:38 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2010-02-01 10:56:40 (GMT)
commite63ea3587444e122242a137a699b5a717d3d26bd (patch)
tree62166b7b542b19510f906770f6c6488c62c47e57 /src/corelib
parentb5298dcf3d29b253a31974762cc9227b25f94e93 (diff)
downloadQt-e63ea3587444e122242a137a699b5a717d3d26bd.zip
Qt-e63ea3587444e122242a137a699b5a717d3d26bd.tar.gz
Qt-e63ea3587444e122242a137a699b5a717d3d26bd.tar.bz2
Fixed no-timeout case for QProcess::waitForFinished in Symbian
QProcess::waitForFinished was panicking in Symbian when timeout of -1 was supplied. Fixed it to disable timeout and block until process exit, as docs indicate it should. Task-number: QTBUG-7667 Reviewed-by: Janne Anttila
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qprocess_symbian.cpp41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
index ddced73..75cde51 100644
--- a/src/corelib/io/qprocess_symbian.cpp
+++ b/src/corelib/io/qprocess_symbian.cpp
@@ -919,34 +919,41 @@ bool QProcessPrivate::waitForFinished(int msecs)
Q_Q(QProcess);
QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished(%d)", msecs);
- TRequestStatus timerStatus = 0;
- TRequestStatus logonStatus = 0;
+ TRequestStatus timerStatus = KErrNone;
+ TRequestStatus logonStatus = KErrNone;
bool timeoutOccurred = false;
// Logon to process to observe its death
if (qt_rprocess_running(symbianProcess)) {
symbianProcess->Logon(logonStatus);
- // Create timer
- RTimer timer;
- timer.CreateLocal();
- TTimeIntervalMicroSeconds32 interval(msecs*1000);
- timer.After(timerStatus, interval);
+ if (msecs < 0) {
+ // If timeout is negative, there is no timeout
+ QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting (just logon)...");
+ User::WaitForRequest(logonStatus);
+ QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed");
+ } else {
+ // Create timer
+ RTimer timer;
+ timer.CreateLocal();
+ TTimeIntervalMicroSeconds32 interval(msecs*1000);
+ timer.After(timerStatus, interval);
- QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting...");
- User::WaitForRequest(logonStatus, timerStatus);
- QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed");
+ QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting (logon + timer)...");
+ User::WaitForRequest(logonStatus, timerStatus);
+ QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed");
- if (timerStatus == KErrNone)
- timeoutOccurred = true;
+ if (timerStatus == KErrNone)
+ timeoutOccurred = true;
- timer.Cancel();
- timer.Close();
+ timer.Cancel();
+ timer.Close();
- symbianProcess->LogonCancel(logonStatus);
+ symbianProcess->LogonCancel(logonStatus);
- // Eat cancel request completion so that it won't mess up main thread scheduling later
- User::WaitForRequest(logonStatus, timerStatus);
+ // 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");
}