From 9db8724e1111ad2d7cd10f4a6df42cfb395a37be Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 19 Jan 2024 13:43:08 +0200 Subject: Client: Emit wlSurfaceDestroyed after actually destroying wl_surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At the moment, the QWaylandWindow::wlSurfaceDestroyed signal is emitted before destroying the wl_surface object. It's the opposite of its name. Furthermore, the client code in Plasma assumes that the wlSurfaceDestroyed signal is emitted after the wl_surface is gone, but it isn't, which is the source of bugs. Technically, it's an API breaking change. But this ordering issue is quite annoying to deal in the client code and the QWaylandWindow native interface api lives in the Private namespace. [ChangeLog][QtWaylandClient][Important Behavior Changes] The QWaylandWindow::surfaceDestroyed() signal is emitted after actually destroying the wl_surface object. Change-Id: I33e27c06795653d3e20e04a36cb39be8c46797ee Reviewed-by: Tor Arne Vestbø --- src/client/qwaylandwindow.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/client') diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index bb33a747f..4c8d2eedc 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -283,19 +283,21 @@ void QWaylandWindow::reset() mTopPopup = mTransientParent && (mTransientParent->window()->type() == Qt::Popup) ? mTransientParent : nullptr; if (mSurface) { + { + QWriteLocker lock(&mSurfaceLock); + invalidateSurface(); + if (mTransientParent) + mTransientParent->removeChildPopup(this); + delete mShellSurface; + mShellSurface = nullptr; + delete mSubSurfaceWindow; + mSubSurfaceWindow = nullptr; + mTransientParent = nullptr; + mSurface.reset(); + mViewport.reset(); + mFractionalScale.reset(); + } emit wlSurfaceDestroyed(); - QWriteLocker lock(&mSurfaceLock); - invalidateSurface(); - if (mTransientParent) - mTransientParent->removeChildPopup(this); - delete mShellSurface; - mShellSurface = nullptr; - delete mSubSurfaceWindow; - mSubSurfaceWindow = nullptr; - mTransientParent = nullptr; - mSurface.reset(); - mViewport.reset(); - mFractionalScale.reset(); } { -- cgit v1.2.3