pmaports/temp/qt5-qtwayland/265998.patch
Bhushan Shah 9e3fa6e6f7
temp/qt5-qtwayland: apply patches suggested by upstream (!509)
These patches are intended to make things work nicely due to regressions
introduced in qt5.12.4. I've tested them in QEMU and they seem to work
fine.

See: https://mail.kde.org/pipermail/kde-distro-packagers/2019-July/000379.html
2019-07-18 17:58:25 +05:30

83 lines
2.5 KiB
Diff

From b13b595dc4f4fe6bdca7b69a21fd934ee233e149 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Sun, 23 Jun 2019 14:48:30 +0200
Subject: [PATCH] Client: Make handleUpdate aware of exposure changes
The wl_surface can be destroyed whilst a render is happening. Calling
wl_surface::frame after the window is reset can crash as wl_surface is
null.
Change-Id: I139a9b234cb6acba81d6c1d5fa58629904a25053
---
src/client/qwaylandwindow.cpp | 10 +++++++++-
src/client/qwaylandwindow_p.h | 4 ++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 5ea0dce1e..7e7a4929c 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())
@@ -210,6 +212,7 @@ void QWaylandWindow::initWindow()
void QWaylandWindow::initializeWlSurface()
{
+ QWriteLocker lock(&mSurfaceLock);
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
}
@@ -245,8 +248,10 @@ void QWaylandWindow::reset(bool sendDestroyEvent)
mShellSurface = nullptr;
delete mSubSurfaceWindow;
mSubSurfaceWindow = nullptr;
- if (isInitialized())
+ if (isInitialized()) {
+ QWriteLocker lock(&mSurfaceLock);
destroy();
+ }
mScreens.clear();
if (mFrameCallback) {
@@ -1145,6 +1150,9 @@ 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 e8c9d5684..d3706442f 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>
@@ -271,6 +273,8 @@ private:
static QMutex mFrameSyncMutex;
static QWaylandWindow *mMouseGrab;
+ QReadWriteLock mSurfaceLock;
+
friend class QWaylandSubSurface;
};
--
2.16.3