summaryrefslogtreecommitdiff
path: root/src/client/qwaylandwindow.cpp
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2019-06-23 14:48:30 +0200
committerDavid Edmundson <davidedmundson@kde.org>2019-08-21 17:59:21 +0100
commit5d43a686fc3d5f13087a61e8ef216ecbbae0d15e (patch)
treee3304f1e0ce3e1b35aaaa22231d759d9837cd960 /src/client/qwaylandwindow.cpp
parent3e96fa1df8d2bc0ec8ab66abae1f20439b786b40 (diff)
downloadqtwayland-5d43a686fc3d5f13087a61e8ef216ecbbae0d15e.tar.gz
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. Fixes: QTBUG-77747 Change-Id: I139a9b234cb6acba81d6c1d5fa58629904a25053 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r--src/client/qwaylandwindow.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 76d7715a..1d4315a3 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -210,6 +210,8 @@ void QWaylandWindow::initWindow()
void QWaylandWindow::initializeWlSurface()
{
+ Q_ASSERT(!isInitialized());
+ QWriteLocker lock(&mSurfaceLock);
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
}
@@ -245,8 +247,10 @@ void QWaylandWindow::reset(bool sendDestroyEvent)
mShellSurface = nullptr;
delete mSubSurfaceWindow;
mSubSurfaceWindow = nullptr;
- if (isInitialized())
+ if (isInitialized()) {
+ QWriteLocker lock(&mSurfaceLock);
destroy();
+ }
mScreens.clear();
if (mFrameCallback) {
@@ -1147,6 +1151,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);