tiles: Evacuate windows in CustomTile::remove()

This commit is contained in:
Vlad Zahorodnii 2024-03-21 11:04:47 +02:00
parent ea9691a2f5
commit 9d3e87bd9d
2 changed files with 7 additions and 1 deletions

View file

@ -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
}

View file

@ -151,7 +151,6 @@ protected:
void insertChild(int position, Tile *item);
void removeChild(Tile *child);
private:
QList<Tile *> m_children;
QList<Window *> m_windows;
Tile *m_parentTile;