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:
@ -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");
|
||||
}
|
||||
}
|
||||
@ -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() {
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user