more monitor checks for shutdown:

This commit is contained in:
vaxerski 2022-10-06 18:43:50 +01:00
parent ee3b770cfd
commit 0508c7d384
2 changed files with 5 additions and 3 deletions

View file

@ -250,6 +250,8 @@ void CCompositor::cleanup() {
m_vWorkspaces.clear(); m_vWorkspaces.clear();
m_vWindows.clear(); m_vWindows.clear();
m_bIsShuttingDown = true;
for (auto& m : m_vMonitors) { for (auto& m : m_vMonitors) {
g_pHyprOpenGL->destroyMonitorResources(m.get()); g_pHyprOpenGL->destroyMonitorResources(m.get());
@ -257,6 +259,8 @@ void CCompositor::cleanup() {
wlr_output_commit(m->output); wlr_output_commit(m->output);
} }
m_vMonitors.clear();
if (g_pXWaylandManager->m_sWLRXWayland) { if (g_pXWaylandManager->m_sWLRXWayland) {
wlr_xwayland_destroy(g_pXWaylandManager->m_sWLRXWayland); wlr_xwayland_destroy(g_pXWaylandManager->m_sWLRXWayland);
g_pXWaylandManager->m_sWLRXWayland = nullptr; g_pXWaylandManager->m_sWLRXWayland = nullptr;
@ -264,8 +268,6 @@ void CCompositor::cleanup() {
wl_display_terminate(m_sWLDisplay); 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" 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. // the PID should not be reused.
} }

View file

@ -140,7 +140,7 @@ void CMonitor::onConnect(bool noRule) {
void CMonitor::onDisconnect() { void CMonitor::onDisconnect() {
if (!m_bEnabled) if (!m_bEnabled || g_pCompositor->m_bIsShuttingDown)
return; return;
// Cleanup everything. Move windows back, snap cursor, shit. // Cleanup everything. Move windows back, snap cursor, shit.