summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2011-11-03 11:10:44 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-03 18:43:52 +0100
commitfaa6113c41b81368c5bbc2a764c2ae9bbc42e415 (patch)
tree5f3323560df67b7f078f0243f8a36a570468af0a /tests/auto
parentec5e59b73c20a7dc6aec96c829f1e53c3fa58c07 (diff)
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>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp
index ce879273eb..face4742b1 100644
--- a/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp
+++ b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp
@@ -392,7 +392,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());
}