Fix destruction order of alive and deleted windows

It's needed to work around the cleanup logic of decorations.

Currently, decorations have a valid QObject parent and they're managed
using std::shared_ptr. That's not a perfect combination, but changing it
is also going to be an involved task because the QObject parent is used
to look up the Window.

In long term, it won't matter since we want to get rid of Deleted.

For what it's worth, it restores the order in which Deleted and normal
windows used to be destroyed prior to
995d509e45.
This commit is contained in:
Vlad Zahorodnii 2023-03-20 11:30:08 +02:00
parent 16a07d5df2
commit d563382350
6 changed files with 12 additions and 8 deletions

View file

@ -160,9 +160,9 @@ void InputPanelV1Window::destroyWindow()
Q_EMIT closed(deleted);
StackingUpdatesBlocker blocker(workspace());
waylandServer()->removeWindow(this);
deleted->unref();
unref();
deleted->unref();
}
NET::WindowType InputPanelV1Window::windowType(bool, int) const

View file

@ -370,11 +370,10 @@ void InternalWindow::destroyWindow()
destroyDecoration();
workspace()->removeInternalWindow(this);
deleted->unref();
m_handle = nullptr;
unref();
deleted->unref();
}
bool InternalWindow::hasPopupGrab() const

View file

@ -181,9 +181,9 @@ void LayerShellV1Window::destroyWindow()
StackingUpdatesBlocker blocker(workspace());
cleanGrouping();
waylandServer()->removeWindow(this);
deleted->unref();
scheduleRearrange();
unref();
deleted->unref();
}
void LayerShellV1Window::closeWindow()

View file

@ -155,9 +155,11 @@ void Unmanaged::release(ReleaseReason releaseReason)
workspace()->removeUnmanaged(this);
if (releaseReason != ReleaseReason::KWinShutsDown) {
disownDataPassedToDeleted();
del->unref();
}
unref();
if (del) {
del->unref();
}
}
void Unmanaged::deleteUnmanaged(Unmanaged *c)

View file

@ -418,9 +418,11 @@ void X11Window::releaseWindow(bool on_shutdown)
unblockGeometryUpdates(); // Don't use GeometryUpdatesBlocker, it would now set the geometry
if (!on_shutdown) {
disownDataPassedToDeleted();
del->unref();
}
unref();
if (del) {
del->unref();
}
ungrabXServer();
}
@ -459,8 +461,8 @@ void X11Window::destroyWindow()
m_frame.reset();
unblockGeometryUpdates(); // Don't use GeometryUpdatesBlocker, it would now set the geometry
disownDataPassedToDeleted();
del->unref();
unref();
del->unref();
}
/**

View file

@ -302,8 +302,9 @@ void XdgSurfaceWindow::destroyWindow()
setDecoration(nullptr);
cleanGrouping();
waylandServer()->removeWindow(this);
deleted->unref();
unref();
deleted->unref();
}
void XdgSurfaceWindow::updateClientArea()