qt5-qtwayland/qtwayland-make-handleupdate-aware-of-exposure-changes.patch
2019-07-08 09:34:45 +02:00

63 lines
1.9 KiB
Diff

diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index ed0fe87..da1b6a0 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -79,6 +79,8 @@ Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore")
QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr;
+QReadWriteLock mSurfaceLock;
+
QWaylandWindow::QWaylandWindow(QWindow *window)
: QPlatformWindow(window)
, mDisplay(waylandScreen()->display())
@@ -209,6 +211,7 @@ void QWaylandWindow::initWindow()
void QWaylandWindow::initializeWlSurface()
{
Q_ASSERT(!isInitialized());
+ QWriteLocker lock(&mSurfaceLock);
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
emit wlSurfaceCreated();
}
@@ -243,6 +246,7 @@ void QWaylandWindow::reset()
mSubSurfaceWindow = nullptr;
if (isInitialized()) {
emit wlSurfaceDestroyed();
+ QWriteLocker lock(&mSurfaceLock);
destroy();
}
mScreens.clear();
@@ -1138,6 +1142,10 @@ void QWaylandWindow::requestUpdate()
void QWaylandWindow::handleUpdate()
{
// TODO: Should sync subsurfaces avoid requesting frame callbacks?
+ QReadLocker lock(&mSurfaceLock);
+ if (!isInitialized()) {
+ return;
+ }
if (mFrameCallback) {
wl_callback_destroy(mFrameCallback);
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
index 746a7a5..4606a7b 100644
--- a/src/client/qwaylandwindow_p.h
+++ b/src/client/qwaylandwindow_p.h
@@ -53,6 +53,8 @@
#include <QtCore/QWaitCondition>
#include <QtCore/QMutex>
+#include <QtCore/QReadWriteLock>
+
#include <QtGui/QIcon>
#include <QtCore/QVariant>
#include <QtCore/QLoggingCategory>
@@ -275,6 +277,8 @@ private:
static QMutex mFrameSyncMutex;
static QWaylandWindow *mMouseGrab;
+ QReadWriteLock mSurfaceLock;
+
friend class QWaylandSubSurface;
};