qt5-qtwayland/0049-Client-Remove-mWaitingForUpdateDelivery.patch

80 lines
3.3 KiB
Diff
Raw Normal View History

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