From 0c28d4e334532e8a8edacf36bcaf4e6b973ea398 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 10 Mar 2024 16:56:32 +0000 Subject: [PATCH] window: prevent vector modification segfault while iterating oops, updateWindow can modify the vec --- src/Window.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Window.cpp b/src/Window.cpp index c63209a0..4c8ff509 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -194,7 +194,14 @@ void CWindow::updateWindowDecos() { m_vDecosToRemove.clear(); + // make a copy because updateWindow can remove decos. + std::vector decos; + for (auto& wd : m_dWindowDecorations) { + decos.push_back(wd.get()); + } + + for (auto& wd : decos) { wd->updateWindow(this); } }