From cf2410f6312697ef86312a391c12ebe329a2e6d1 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 25 May 2023 22:56:11 +0100 Subject: [PATCH] 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 --- src/window.cpp | 10 ++++------ src/window.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 20ef92bb70..d2cf753332 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -557,21 +557,19 @@ Layer Window::layer() const void Window::updateLayer() { + if (isDeleted()) { + return; + } if (layer() == belongsToLayer()) { return; } 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) { (*it)->updateLayer(); } } -void Window::invalidateLayer() -{ - m_layer = UnknownLayer; -} - Layer Window::belongsToLayer() const { // NOTICE while showingDesktop, desktops move to the AboveLayer diff --git a/src/window.h b/src/window.h index 04f6b8b0cd..9fd10cdb63 100644 --- a/src/window.h +++ b/src/window.h @@ -1507,7 +1507,6 @@ protected: virtual Layer belongsToLayer() const; virtual bool belongsToDesktop() const; - void invalidateLayer(); bool isActiveFullScreen() const; virtual Layer layerForDock() const;