Blame SOURCES/0035-Client-Remove-mWaitingForUpdateDelivery.patch

869fe3
From a97759d032a40045551546ca17300891d4067ee4 Mon Sep 17 00:00:00 2001
9fb289
From: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
9fb289
Date: Tue, 1 Feb 2022 13:05:36 +0200
869fe3
Subject: [PATCH 35/40] Client: Remove mWaitingForUpdateDelivery
9fb289
9fb289
Currently, mWaitingForUpdateDelivery is shared between the main thread
9fb289
(doHandleFrameCallback()) and the frame callback event thread
9fb289
(handleFrameCallback()), however the access to it is not synchronized
9fb289
between both threads. On the other hand, QWaylandWindow
9fb289
already ensures not to create a frame callback if there's already one
9fb289
pending.
9fb289
9fb289
This change removes mWaitingForUpdateDelivery flag because it should be
9fb289
already covered by mWaitingForFrameCallback and to remove unsynchronized
9fb289
shared state between threads.
9fb289
9fb289
Change-Id: I0e5a25d18d1e66c4d7683e7e972330c4d7cbbf38
9fb289
Reviewed-by: David Edmundson <davidedmundson@kde.org>
9fb289
(cherry picked from commit feb1a5c207c13d0bf87c0d8ad039279dbf8cee9e)
9fb289
---
9fb289
 src/client/qwaylandwindow.cpp | 29 ++++++++++++-----------------
9fb289
 src/client/qwaylandwindow_p.h |  1 -
9fb289
 2 files changed, 12 insertions(+), 18 deletions(-)
9fb289
9fb289
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
9fb289
index 4c5711a0..949374b1 100644
9fb289
--- a/src/client/qwaylandwindow.cpp
9fb289
+++ b/src/client/qwaylandwindow.cpp
9fb289
@@ -648,23 +648,18 @@ void QWaylandWindow::handleFrameCallback()
9fb289
     mFrameCallbackElapsedTimer.invalidate();
9fb289
 
9fb289
     // The rest can wait until we can run it on the correct thread
9fb289
-    if (!mWaitingForUpdateDelivery) {
9fb289
-        auto doHandleExpose = [this]() {
9fb289
-            bool wasExposed = isExposed();
9fb289
-            mFrameCallbackTimedOut = false;
9fb289
-            if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed?
9fb289
-                sendExposeEvent(QRect(QPoint(), geometry().size()));
9fb289
-            if (wasExposed && hasPendingUpdateRequest())
9fb289
-                deliverUpdateRequest();
9fb289
-
9fb289
-            mWaitingForUpdateDelivery = false;
9fb289
-        };
9fb289
-
9fb289
-        // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync()
9fb289
-        // in the single-threaded case.
9fb289
-        mWaitingForUpdateDelivery = true;
9fb289
-        QMetaObject::invokeMethod(this, doHandleExpose, Qt::QueuedConnection);
9fb289
-    }
9fb289
+    auto doHandleExpose = [this]() {
9fb289
+        bool wasExposed = isExposed();
9fb289
+        mFrameCallbackTimedOut = false;
9fb289
+        if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed?
9fb289
+            sendExposeEvent(QRect(QPoint(), geometry().size()));
9fb289
+        if (wasExposed && hasPendingUpdateRequest())
9fb289
+            deliverUpdateRequest();
9fb289
+    };
9fb289
+
9fb289
+    // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync()
9fb289
+    // in the single-threaded case.
9fb289
+    QMetaObject::invokeMethod(this, doHandleExpose, Qt::QueuedConnection);
9fb289
 
9fb289
     mFrameSyncWait.notify_all();
9fb289
 }
9fb289
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
9fb289
index d45980a8..3ff68ccb 100644
9fb289
--- a/src/client/qwaylandwindow_p.h
9fb289
+++ b/src/client/qwaylandwindow_p.h
9fb289
@@ -228,7 +228,6 @@ protected:
9fb289
     WId mWindowId;
9fb289
     bool mWaitingForFrameCallback = false;
9fb289
     bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out
9fb289
-    bool mWaitingForUpdateDelivery = false;
9fb289
     int mFrameCallbackCheckIntervalTimerId = -1;
9fb289
     QElapsedTimer mFrameCallbackElapsedTimer;
9fb289
     struct ::wl_callback *mFrameCallback = nullptr;
9fb289
-- 
9fb289
2.35.1
9fb289