Blame SOURCES/0043-Connect-flushRequest-after-forceRoundTrip.patch

b814f0
From 98dc33fdc66f15a0e69f3024fcef046f11adc58c Mon Sep 17 00:00:00 2001
b814f0
From: Elvis Lee <kwangwoong.lee@lge.com>
b814f0
Date: Wed, 17 Mar 2021 16:31:10 +0900
b814f0
Subject: [PATCH 43/52] Connect flushRequest after forceRoundTrip
b814f0
b814f0
If flushRequest is connected with aboutToBlock, the flushRequest
b814f0
may consumes all events so that processEvents might be blocked in forceRoundTrip.
b814f0
b814f0
Change-Id: I12b2c506e8442bf0e75f6ab6e418d3e1eea6d68c
b814f0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
b814f0
(cherry picked from commit 654a54755138c520c3a41210d8078196e9a2c1bf)
b814f0
---
b814f0
 src/client/qwaylandintegration.cpp | 11 +++++++----
b814f0
 1 file changed, 7 insertions(+), 4 deletions(-)
b814f0
b814f0
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
b814f0
index f5632982..3a6fa651 100644
b814f0
--- a/src/client/qwaylandintegration.cpp
b814f0
+++ b/src/client/qwaylandintegration.cpp
b814f0
@@ -192,10 +192,6 @@ QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const
b814f0
 
b814f0
 void QWaylandIntegration::initialize()
b814f0
 {
b814f0
-    QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
b814f0
-    QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests()));
b814f0
-    QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests()));
b814f0
-
b814f0
     int fd = wl_display_get_fd(mDisplay->wl_display());
b814f0
     QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data());
b814f0
     QObject::connect(sn, SIGNAL(activated(QSocketDescriptor)), mDisplay.data(), SLOT(flushRequests()));
b814f0
@@ -203,6 +199,13 @@ void QWaylandIntegration::initialize()
b814f0
     // Call after eventDispatcher is fully connected, for QWaylandDisplay::forceRoundTrip()
b814f0
     mDisplay->initialize();
b814f0
 
b814f0
+    // But the aboutToBlock() and awake() should be connected after initializePlatform().
b814f0
+    // Otherwise the connected flushRequests() may consumes up all events before processEvents starts to wait,
b814f0
+    // so that processEvents(QEventLoop::WaitForMoreEvents) may be blocked in the forceRoundTrip().
b814f0
+    QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
b814f0
+    QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests()));
b814f0
+    QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests()));
b814f0
+
b814f0
     // Qt does not support running with no screens
b814f0
     mDisplay->ensureScreen();
b814f0
 }
b814f0
-- 
b814f0
2.35.1
b814f0