summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2011-11-03 10:10:44 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-02-09 23:18:31 (GMT)
commit42004eccf246cbc110f0ad22caa85efeeeb640bb (patch)
tree53537c212e8f03a53023d993d9760f157f9b9744
parenta903d59b9a353d10862dd975db11b1b3d132bdf5 (diff)
downloadQt-42004eccf246cbc110f0ad22caa85efeeeb640bb.zip
Qt-42004eccf246cbc110f0ad22caa85efeeeb640bb.tar.gz
Qt-42004eccf246cbc110f0ad22caa85efeeeb640bb.tar.bz2
Fix unstable test due to a race in QThread
QThread::finished() is emitted before setting the thread's state to finished and !running, which means it's possible to receive the finished() signal and act on it while QThread::isRunning() still returns true. This test randomly fails due to this race. Fix it by using checking the return value of QThread::wait() instead. Change-Id: Ibf347fc9a2e8d32b328227ee6978e1129dd781f4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit faa6113c41b81368c5bbc2a764c2ae9bbc42e415)
-rw-r--r--tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp
index 3213a1b..4efc318 100644
--- a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp
+++ b/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp
@@ -426,7 +426,7 @@ void tst_QDBusPendingCall::watcher_waitForFinished_threaded()
QTestEventLoop::instance().connect(&thread, SIGNAL(finished()), SLOT(exitLoop()));
thread.start();
QTestEventLoop::instance().enterLoop(10);
- QVERIFY(!thread.isRunning());
+ QVERIFY(thread.wait(3000));
QVERIFY(!QTestEventLoop::instance().timeout());
}