summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtesteventloop.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtesteventloop.h')
-rw-r--r--src/testlib/qtesteventloop.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/testlib/qtesteventloop.h b/src/testlib/qtesteventloop.h
index 9e738d2c47..034655cc50 100644
--- a/src/testlib/qtesteventloop.h
+++ b/src/testlib/qtesteventloop.h
@@ -40,6 +40,7 @@
#include <QtCore/qeventloop.h>
#include <QtCore/qobject.h>
#include <QtCore/qpointer.h>
+#include <QtCore/qthread.h>
QT_BEGIN_NAMESPACE
@@ -101,6 +102,12 @@ inline void QTestEventLoop::enterLoopMSecs(int ms)
inline void QTestEventLoop::exitLoop()
{
+ if (thread() != QThread::currentThread())
+ {
+ QMetaObject::invokeMethod(this, "exitLoop", Qt::QueuedConnection);
+ return;
+ }
+
if (timerId != -1)
killTimer(timerId);
timerId = -1;