From 28d6b5230a8caa4b5d627d7fe3372d8c552a73ee Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 2 Apr 2024 11:40:56 +0300 Subject: [PATCH] Unset Window::tile() when the window is closed If a window is closed, its geometry should not change. The window has to leave its assigned tile so it's not possibly moved or resized. --- src/internalwindow.cpp | 1 + src/window.cpp | 5 ++--- src/x11window.cpp | 2 ++ src/xdgshellwindow.cpp | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/internalwindow.cpp b/src/internalwindow.cpp index db4b6d167d..ae783d455b 100644 --- a/src/internalwindow.cpp +++ b/src/internalwindow.cpp @@ -335,6 +335,7 @@ void InternalWindow::destroyWindow() Q_EMIT closed(); + setTile(nullptr); workspace()->removeInternalWindow(this); m_handle = nullptr; diff --git a/src/window.cpp b/src/window.cpp index 4c0844a578..ce2435333f 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -101,9 +101,7 @@ Window::Window() Window::~Window() { - if (m_tile) { - m_tile->removeWindow(this); - } + Q_ASSERT(!m_tile); Q_ASSERT(m_blockGeometryUpdates == 0); } @@ -3611,6 +3609,7 @@ void Window::setTile(Tile *tile) m_tile = tile; if (m_tile) { + Q_ASSERT(!isDeleted()); m_tile->addWindow(this); } diff --git a/src/x11window.cpp b/src/x11window.cpp index 6b3776d7ce..ca748833c0 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -407,6 +407,7 @@ void X11Window::releaseWindow(bool on_shutdown) if (isInteractiveMoveResize()) { Q_EMIT interactiveMoveResizeFinished(); } + setTile(nullptr); workspace()->rulebook()->discardUsed(this, true); // Remove ForceTemporarily rules StackingUpdatesBlocker blocker(workspace()); stopDelayedInteractiveMoveResize(); @@ -485,6 +486,7 @@ void X11Window::destroyWindow() if (isInteractiveMoveResize()) { Q_EMIT interactiveMoveResizeFinished(); } + setTile(nullptr); workspace()->rulebook()->discardUsed(this, true); // Remove ForceTemporarily rules StackingUpdatesBlocker blocker(workspace()); stopDelayedInteractiveMoveResize(); diff --git a/src/xdgshellwindow.cpp b/src/xdgshellwindow.cpp index 6b13df5b1f..ef92707ffc 100644 --- a/src/xdgshellwindow.cpp +++ b/src/xdgshellwindow.cpp @@ -300,6 +300,7 @@ void XdgSurfaceWindow::destroyWindow() leaveInteractiveMoveResize(); Q_EMIT interactiveMoveResizeFinished(); } + setTile(nullptr); m_configureTimer->stop(); qDeleteAll(m_configureEvents); m_configureEvents.clear();