From 79862c957cd83f5bbb42e2881b3cbcbc72941b78 Mon Sep 17 00:00:00 2001 From: memchr <118117622+memchr@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:59:10 +0000 Subject: [PATCH] layout: add missing groupbar decoration to the window (#3235) * fix: add missing groupbar decoration to the window Add groupbar decoration to the operand window of `CWindow::insertWindowToGroup` if it does not exist, to prevent segmentation faults when mouse events are triggered after moving the window to a group, where `getDecorationByType(DECORATION_GROUPBAR)` unexpectedly returns nullptr. Also fixed a bug where the group bar disappeared when the moveIntoGroup dispatcher's operand window was in a group. * Update Window.cpp --- src/Window.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Window.cpp b/src/Window.cpp index 28e783505..832d84a94 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -733,6 +733,9 @@ void CWindow::insertWindowToGroup(CWindow* pWindow) { const auto BEGINAT = this; const auto ENDAT = m_sGroupData.pNextWindow; + if (!pWindow->getDecorationByType(DECORATION_GROUPBAR)) + pWindow->m_dWindowDecorations.emplace_back(std::make_unique(pWindow)); + if (!pWindow->m_sGroupData.pNextWindow) { BEGINAT->m_sGroupData.pNextWindow = pWindow; pWindow->m_sGroupData.pNextWindow = ENDAT;