diff options
author | memchr <[email protected]> | 2023-09-22 10:06:09 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2023-09-22 11:06:09 +0100 |
commit | ea5d9584dafc73412489b96369ffb090f51edb4d (patch) | |
tree | 66b6c3e4ab51d77ac4b55d5ff44eecb3f1696986 | |
parent | 1357b66091ecd73f097d19d527a23a9ae72a4ff1 (diff) | |
download | Hyprland-ea5d9584dafc73412489b96369ffb090f51edb4d.tar.gz Hyprland-ea5d9584dafc73412489b96369ffb090f51edb4d.zip |
refactor: manually resets singletons (#3395)
-rw-r--r-- | src/Compositor.cpp | 18 | ||||
-rw-r--r-- | src/helpers/AnimatedVariable.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 2960fc2c..d3f8bab2 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -74,6 +74,24 @@ CCompositor::CCompositor() { CCompositor::~CCompositor() { cleanup(); + g_pPluginSystem.reset(); + g_pHyprNotificationOverlay.reset(); + g_pDebugOverlay.reset(); + g_pEventManager.reset(); + g_pSessionLockManager.reset(); + g_pProtocolManager.reset(); + g_pXWaylandManager.reset(); + g_pHyprRenderer.reset(); + g_pHyprOpenGL.reset(); + g_pInputManager.reset(); + g_pThreadManager.reset(); + g_pConfigManager.reset(); + g_pLayoutManager.reset(); + g_pHyprError.reset(); + g_pConfigManager.reset(); + g_pAnimationManager.reset(); + g_pKeybindManager.reset(); + g_pHookSystem.reset(); } void CCompositor::setRandomSplash() { diff --git a/src/helpers/AnimatedVariable.cpp b/src/helpers/AnimatedVariable.cpp index 8c5c889f..50de0149 100644 --- a/src/helpers/AnimatedVariable.cpp +++ b/src/helpers/AnimatedVariable.cpp @@ -51,6 +51,8 @@ CAnimatedVariable::~CAnimatedVariable() { } void CAnimatedVariable::unregister() { + if (!g_pAnimationManager) + return; std::erase_if(g_pAnimationManager->m_vAnimatedVariables, [&](const auto& other) { return other == this; }); m_bIsRegistered = false; disconnectFromActive(); diff --git a/src/main.cpp b/src/main.cpp index 96b0dc46..9f8d61fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,6 +106,7 @@ int main(int argc, char** argv) { // If we are here it means we got yote. Debug::log(LOG, "Hyprland reached the end."); + g_pCompositor.reset(); return EXIT_SUCCESS; } |