From 3ccf5602526d7aa864282c463e986dcdb7f5e01a Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 26 May 2023 12:03:44 +0100 Subject: [PATCH] workspace: Add asserts to check double window insertion We have a few crash reports that point to m_windows getting out of sync with reality. Add some additional checks in the hope they point to something useful. --- src/workspace.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/workspace.cpp b/src/workspace.cpp index 70193c4c1c..0cfd93a3f0 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -703,6 +703,7 @@ void Workspace::addX11Window(X11Window *window) } else { m_focusChain->update(window, FocusChain::Update); } + Q_ASSERT(!m_windows.contains(window)); m_windows.append(window); addToStack(window); updateClientArea(); // This cannot be in manage(), because the window got added only now @@ -725,6 +726,7 @@ void Workspace::addX11Window(X11Window *window) void Workspace::addUnmanaged(X11Window *window) { + Q_ASSERT(!m_windows.contains(window)); m_windows.append(window); addToStack(window); updateStackingOrder(true); @@ -791,6 +793,7 @@ void Workspace::addWaylandWindow(Window *window) m_placement->place(window, area); } } + Q_ASSERT(!m_windows.contains(window)); m_windows.append(window); addToStack(window); @@ -2017,6 +2020,7 @@ void Workspace::updateTabbox() void Workspace::addInternalWindow(InternalWindow *window) { + Q_ASSERT(!m_windows.contains(window)); m_windows.append(window); addToStack(window);