summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-10-30 08:59:49 +0100
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-11-04 13:16:59 +0100
commite049a82502d363d8cc9764188ca726ce9d1b62e5 (patch)
treeee00ed43d0a18d9797ccb5c6312a3c02754b02fa
parentc42dd53cdb2edfef0ee8bd0e7d8775dd0ab52850 (diff)
Client tests: Fix flaky deadlock
Sometimes the test would wait indefinitely in the compositor constructor, while also waiting in the compositor thread for m_ready to become true. m_ready is set to true in applicationInitialized(), which is supposed to be called from the client thread after QGuiApplication has been created (and also after the MockCompositor constructor has returned). I.e. the problem is that the wake in MockCompositor::run may sometimes happen before the MockCompositor::MockCompositor starts waiting. Move the wake inside the pre-initialized compositor loop. Essentially waking every 20 ms until the application is initialized. Fixes: QTBUG-66570 Change-Id: Ia5eba5d08ce4d1d3eeca99eae6cfa7d9d4fd5a0b Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 62e959eaa707a163daca69a42c733bbd272d41d6)
-rw-r--r--tests/auto/client/shared/mockcompositor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/client/shared/mockcompositor.cpp b/tests/auto/client/shared/mockcompositor.cpp
index 797c05c4..096f6ffc 100644
--- a/tests/auto/client/shared/mockcompositor.cpp
+++ b/tests/auto/client/shared/mockcompositor.cpp
@@ -337,9 +337,9 @@ void *MockCompositor::run(void *data)
Impl::Compositor compositor;
controller->m_compositor = &compositor;
- controller->m_waitCondition.wakeOne();
while (!controller->m_ready) {
+ controller->m_waitCondition.wakeOne();
controller->dispatchCommands();
compositor.dispatchEvents(20);
}