From 9d3e87bd9d36b5345eadae64903017fa21fcd2b6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 21 Mar 2024 11:04:47 +0200 Subject: [PATCH] tiles: Evacuate windows in CustomTile::remove() --- src/tiles/customtile.cpp | 7 +++++++ src/tiles/tile.h | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tiles/customtile.cpp b/src/tiles/customtile.cpp index 9eba81ab34..0fbbe31f7e 100644 --- a/src/tiles/customtile.cpp +++ b/src/tiles/customtile.cpp @@ -10,6 +10,7 @@ #include "customtile.h" #include "core/output.h" #include "tilemanager.h" +#include "window.h" namespace KWin { @@ -273,6 +274,7 @@ void CustomTile::remove() manager()->model()->beginRemoveTile(this); parentT->removeChild(this); + m_parentTile = nullptr; manager()->model()->endRemoveTile(); manager()->tileRemoved(this); @@ -320,6 +322,11 @@ void CustomTile::remove() } } + const auto windows = std::exchange(m_windows, {}); + for (Window *window : windows) { + window->setTile(m_tiling->bestTileForPosition(window->moveResizeGeometry().center())); + } + deleteLater(); // not using "delete this" because QQmlEngine will crash } diff --git a/src/tiles/tile.h b/src/tiles/tile.h index 4bd628f716..63868bf8e1 100644 --- a/src/tiles/tile.h +++ b/src/tiles/tile.h @@ -151,7 +151,6 @@ protected: void insertChild(int position, Tile *item); void removeChild(Tile *child); -private: QList m_children; QList m_windows; Tile *m_parentTile;