summaryrefslogtreecommitdiff
path: root/src/desktop/Workspace.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/desktop/Workspace.cpp')
-rw-r--r--src/desktop/Workspace.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp
index 734b7c8e..cbc4b16e 100644
--- a/src/desktop/Workspace.cpp
+++ b/src/desktop/Workspace.cpp
@@ -57,11 +57,15 @@ CWorkspace::~CWorkspace() {
Debug::log(LOG, "Destroying workspace ID {}", m_iID);
- g_pHookSystem->unhook(m_pFocusedWindowHook);
-
- g_pEventManager->postEvent({"destroyworkspace", m_szName});
- g_pEventManager->postEvent({"destroyworkspacev2", std::format("{},{}", m_iID, m_szName)});
- EMIT_HOOK_EVENT("destroyWorkspace", this);
+ // check if g_pHookSystem and g_pEventManager exist, they might be destroyed as in when the compositor is closing.
+ if (g_pHookSystem)
+ g_pHookSystem->unhook(m_pFocusedWindowHook);
+
+ if (g_pEventManager) {
+ g_pEventManager->postEvent({"destroyworkspace", m_szName});
+ g_pEventManager->postEvent({"destroyworkspacev2", std::format("{},{}", m_iID, m_szName)});
+ EMIT_HOOK_EVENT("destroyWorkspace", this);
+ }
}
void CWorkspace::startAnim(bool in, bool left, bool instant) {