mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 01:05:58 +01:00
workspace: fix crash on destruction of compositor (#5495)
when the compositor destructs because of exiting hyprland the hookmanager and eventmanager is already destroyed, add an if check in the destructor of workspace so it doesnt segfault on exit.
This commit is contained in:
parent
63e3668529
commit
125a8f7e07
1 changed files with 8 additions and 4 deletions
|
@ -57,11 +57,15 @@ CWorkspace::~CWorkspace() {
|
||||||
|
|
||||||
Debug::log(LOG, "Destroying workspace ID {}", m_iID);
|
Debug::log(LOG, "Destroying workspace ID {}", m_iID);
|
||||||
|
|
||||||
|
// 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);
|
g_pHookSystem->unhook(m_pFocusedWindowHook);
|
||||||
|
|
||||||
|
if (g_pEventManager) {
|
||||||
g_pEventManager->postEvent({"destroyworkspace", m_szName});
|
g_pEventManager->postEvent({"destroyworkspace", m_szName});
|
||||||
g_pEventManager->postEvent({"destroyworkspacev2", std::format("{},{}", m_iID, m_szName)});
|
g_pEventManager->postEvent({"destroyworkspacev2", std::format("{},{}", m_iID, m_szName)});
|
||||||
EMIT_HOOK_EVENT("destroyWorkspace", this);
|
EMIT_HOOK_EVENT("destroyWorkspace", this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
||||||
|
|
Loading…
Reference in a new issue