From 9742ac7596b83025c7ab0cf4e92d9db347b4b5c3 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 4 Jul 2022 19:41:55 +0200 Subject: [PATCH] attempt to fix a specialworkspace crash --- src/managers/KeybindManager.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index d26b0e92..061f60a9 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -890,11 +890,16 @@ void CKeybindManager::toggleSpecialWorkspace(std::string args) { } } } else { + auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(SPECIAL_WORKSPACE_ID); + + if (!PSPECIALWORKSPACE) { + // ??? happens sometimes...? + PSPECIALWORKSPACE = g_pCompositor->m_vWorkspaces.emplace_back(std::make_unique(g_pCompositor->m_pLastMonitor->ID, "special", true)).get(); + } + g_pCompositor->m_pLastMonitor->specialWorkspaceOpen = true; g_pLayoutManager->getCurrentLayout()->recalculateMonitor(g_pCompositor->m_pLastMonitor->ID); - const auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(SPECIAL_WORKSPACE_ID); - PSPECIALWORKSPACE->startAnim(true, true); PSPECIALWORKSPACE->m_iMonitorID = g_pCompositor->m_pLastMonitor->ID; }