summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2017-11-22 16:10:39 +0100
committerJohan Helsing <johan.helsing@qt.io>2017-11-23 15:53:42 +0000
commitf82bf9e25d400f0f3786c0519a3369f782e92640 (patch)
treea103f828b120ad3cde6cddc5492a66efb134808e /src
parent62abd51e9528f5710918d94b75647704b5edd445 (diff)
Fix tst_client::windowScreen and tst_client::screens sometimes freezing
Sometimes the callback in forceRoundTrip would be handled in response to the QEventDispatcher::aboutToBlockSignal signal emitted at the start of processEvents, and would wait there for more events that may never come. Task-number: QTBUG-64696 Change-Id: I4e38a4dd4158afc606e779ff615b5eef98b955b0 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylanddisplay.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index b2372f088..178b26199 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -343,6 +343,15 @@ sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
bool *done = static_cast<bool *>(data);
*done = true;
+
+ // If the wl_callback done event is received after the condition check in the while loop in
+ // forceRoundTrip(), but before the call to processEvents, the call to processEvents may block
+ // forever if no more events are posted (eventhough the callback is handled in response to the
+ // aboutToBlock signal). Hence, we wake up the event dispatcher so forceRoundTrip may return.
+ // (QTBUG-64696)
+ if (auto *dispatcher = QThread::currentThread()->eventDispatcher())
+ dispatcher->wakeUp();
+
wl_callback_destroy(callback);
}