3
0
mirror of https://github.com/hyprwm/Hyprland.git synced 2026-08-18 11:02:10 +00:00

desktop/groups: fix crash on dissolution (#15135)

This commit is contained in:
Vaxry
2026-06-27 10:22:53 +02:00
committed by GitHub
parent defc6be1f4
commit 9405c7133e
3 changed files with 18 additions and 2 deletions

View File

@ -472,3 +472,15 @@ TEST_CASE(groups) {
Tests::killAllWindows();
ASSERT(Tests::windowCount(), 0);
}
TEST_CASE(groupsNoCrash) {
auto kittyA = Tests::spawnKitty("kittyA");
OK(getFromSocket("/dispatch hl.dsp.group.toggle()"));
OK(getFromSocket("/dispatch hl.dsp.group.toggle()"));
{
auto curr = getFromSocket("/activewindow");
EXPECT_CONTAINS(curr, "kittyA");
}
}

View File

@ -66,7 +66,9 @@ void CGroup::init() {
}
void CGroup::destroy() {
while (true) {
const auto POWNER = head();
while (!m_windows.empty()) {
if (m_windows.size() == 1) {
remove(m_windows.at(0).lock());
break;
@ -75,7 +77,8 @@ void CGroup::destroy() {
remove(m_windows.at(0).lock());
}
g_pEventManager->postEvent(SHyprIPCEvent({.event = "togglegroup", .data = std::format("0,{:x}", rc<uintptr_t>(m_windows.at(0).get()))}));
if (POWNER)
g_pEventManager->postEvent(SHyprIPCEvent({.event = "togglegroup", .data = std::format("0,{:x}", rc<uintptr_t>(POWNER.get()))}));
}
CGroup::~CGroup() {

View File

@ -36,6 +36,7 @@ TEST(Helpers, isDirectionString) {
EXPECT_FALSE(isDirection("leftover"));
EXPECT_FALSE(isDirection("desc:Monitor"));
EXPECT_FALSE(isDirection(""));
EXPECT_FALSE(isDirection("i_am_single"));
}
// normalizeAngleRad