Guard updateLayer for deleted windows

When a window is deleted it all "set" operations should no-op.

As for the bug specifically, we have an effect that keeps the desktop
alive. If a user calls showDesktop not only do we not update the
stacking order, we also call updateLayer when the client closes this is
after the window is in the deleted state.

BUG: 470067
This commit is contained in:
David Edmundson 2023-05-25 22:56:11 +01:00 committed by Vlad Zahorodnii
parent 1a883f7626
commit cf2410f631
2 changed files with 4 additions and 7 deletions

View file

@ -557,21 +557,19 @@ Layer Window::layer() const
void Window::updateLayer() void Window::updateLayer()
{ {
if (isDeleted()) {
return;
}
if (layer() == belongsToLayer()) { if (layer() == belongsToLayer()) {
return; return;
} }
StackingUpdatesBlocker blocker(workspace()); StackingUpdatesBlocker blocker(workspace());
invalidateLayer(); // invalidate, will be updated when doing restacking m_layer = UnknownLayer; // invalidate, will be updated when doing restacking
for (auto it = transients().constBegin(), end = transients().constEnd(); it != end; ++it) { for (auto it = transients().constBegin(), end = transients().constEnd(); it != end; ++it) {
(*it)->updateLayer(); (*it)->updateLayer();
} }
} }
void Window::invalidateLayer()
{
m_layer = UnknownLayer;
}
Layer Window::belongsToLayer() const Layer Window::belongsToLayer() const
{ {
// NOTICE while showingDesktop, desktops move to the AboveLayer // NOTICE while showingDesktop, desktops move to the AboveLayer

View file

@ -1507,7 +1507,6 @@ protected:
virtual Layer belongsToLayer() const; virtual Layer belongsToLayer() const;
virtual bool belongsToDesktop() const; virtual bool belongsToDesktop() const;
void invalidateLayer();
bool isActiveFullScreen() const; bool isActiveFullScreen() const;
virtual Layer layerForDock() const; virtual Layer layerForDock() const;