From 325a2338976c3cca6278436af03e7bd4e4378d7c Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 18 Mar 2023 22:20:36 +0200 Subject: Client: Fix wl_surface destruction order The main thread can attempt to close the window while the QtQuick render thread is still busy. If that happens, ensure that QtQuick render thread has finished rendering and presented the last frame before destroying the wp_viewport and any other associated surface extensions so the window destruction looks more reasonable. Change-Id: I8d2a3372fe6de51f357eed513baaa34a148470e3 Reviewed-by: David Edmundson (cherry picked from commit 504b9f1491d7244d05bee243bacf03aa9df1a17c) Reviewed-by: Qt Cherry-pick Bot --- src/client/qwaylandwindow.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index a1c3a58e..d2199df4 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -262,18 +262,18 @@ void QWaylandWindow::endFrame() void QWaylandWindow::reset() { closeChildPopups(); - delete mShellSurface; - mShellSurface = nullptr; - delete mSubSurfaceWindow; - mSubSurfaceWindow = nullptr; - mViewport.reset(); - mFractionalScale.reset(); if (mSurface) { emit wlSurfaceDestroyed(); QWriteLocker lock(&mSurfaceLock); invalidateSurface(); + delete mShellSurface; + mShellSurface = nullptr; + delete mSubSurfaceWindow; + mSubSurfaceWindow = nullptr; mSurface.reset(); + mViewport.reset(); + mFractionalScale.reset(); } { -- cgit v1.2.1