scene: Add an assert to debug crash in BlurEffect::prePaintWindow()

This checks whether a WindowItem is destroyed in the middle of a painting
cycle.

This is meant as short-term means to debug the issue.
This commit is contained in:
Vlad Zahorodnii 2024-08-29 17:07:29 +03:00
parent b825d5fdc3
commit b708a93c1e
2 changed files with 12 additions and 0 deletions

View file

@ -102,6 +102,14 @@ WorkspaceScene::WorkspaceScene(std::unique_ptr<ItemRenderer> renderer)
connect(waylandServer()->seat(), &SeatInterface::dragStarted, this, &WorkspaceScene::createDndIconItem); connect(waylandServer()->seat(), &SeatInterface::dragStarted, this, &WorkspaceScene::createDndIconItem);
connect(waylandServer()->seat(), &SeatInterface::dragEnded, this, &WorkspaceScene::destroyDndIconItem); connect(waylandServer()->seat(), &SeatInterface::dragEnded, this, &WorkspaceScene::destroyDndIconItem);
} }
connect(m_containerItem.get(), &Item::childAdded, this, [this](Item *item) {
connect(item, &Item::destroyed, this, [this]() {
if (m_painting) {
qFatal("Destroyed an item while painting");
}
});
});
} }
WorkspaceScene::~WorkspaceScene() WorkspaceScene::~WorkspaceScene()
@ -255,6 +263,7 @@ void WorkspaceScene::frame(SceneDelegate *delegate, OutputFrame *frame)
QRegion WorkspaceScene::prePaint(SceneDelegate *delegate) QRegion WorkspaceScene::prePaint(SceneDelegate *delegate)
{ {
m_painting = true;
createStackingOrder(); createStackingOrder();
painted_delegate = delegate; painted_delegate = delegate;
@ -384,6 +393,8 @@ void WorkspaceScene::preparePaintSimpleScreen()
void WorkspaceScene::postPaint() void WorkspaceScene::postPaint()
{ {
m_painting = false;
for (WindowItem *w : std::as_const(stacking_order)) { for (WindowItem *w : std::as_const(stacking_order)) {
effects->postPaintWindow(w->effectWindow()); effects->postPaintWindow(w->effectWindow());
} }

View file

@ -134,6 +134,7 @@ private:
std::unique_ptr<Item> m_containerItem; std::unique_ptr<Item> m_containerItem;
std::unique_ptr<Item> m_overlayItem; std::unique_ptr<Item> m_overlayItem;
std::unique_ptr<DragAndDropIconItem> m_dndIcon; std::unique_ptr<DragAndDropIconItem> m_dndIcon;
bool m_painting = false;
}; };
} // namespace } // namespace