From 0508c7d3849fe2f557851619b0eb877b80112c66 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 6 Oct 2022 18:43:50 +0100 Subject: [PATCH] more monitor checks for shutdown: --- src/Compositor.cpp | 6 ++++-- src/helpers/Monitor.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 7c8b1ef8..3fa1448b 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -250,6 +250,8 @@ void CCompositor::cleanup() { m_vWorkspaces.clear(); m_vWindows.clear(); + m_bIsShuttingDown = true; + for (auto& m : m_vMonitors) { g_pHyprOpenGL->destroyMonitorResources(m.get()); @@ -257,6 +259,8 @@ void CCompositor::cleanup() { wlr_output_commit(m->output); } + m_vMonitors.clear(); + if (g_pXWaylandManager->m_sWLRXWayland) { wlr_xwayland_destroy(g_pXWaylandManager->m_sWLRXWayland); g_pXWaylandManager->m_sWLRXWayland = nullptr; @@ -264,8 +268,6 @@ void CCompositor::cleanup() { wl_display_terminate(m_sWLDisplay); - m_bIsShuttingDown = true; - g_pKeybindManager->spawn("sleep 5 && kill -9 " + std::to_string(m_iHyprlandPID)); // this is to prevent that random "freezing" // the PID should not be reused. } diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 87b5edf8..cb128617 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -140,7 +140,7 @@ void CMonitor::onConnect(bool noRule) { void CMonitor::onDisconnect() { - if (!m_bEnabled) + if (!m_bEnabled || g_pCompositor->m_bIsShuttingDown) return; // Cleanup everything. Move windows back, snap cursor, shit.