Added an exit dispatcher and no more SIGSEGV on exit

This commit is contained in:
vaxerski 2022-05-29 00:00:47 +02:00
parent 894ae2d742
commit 3f8845a6a7
4 changed files with 10 additions and 0 deletions

View file

@ -144,6 +144,9 @@ void CCompositor::cleanupExit() {
if (!m_sWLDisplay) if (!m_sWLDisplay)
return; return;
m_lWorkspaces.clear();
m_lWindows.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;

BIN
src/gmon.out Normal file

Binary file not shown.

View file

@ -20,6 +20,7 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["focusmonitor"] = focusMonitor; m_mDispatchers["focusmonitor"] = focusMonitor;
m_mDispatchers["movecursortocorner"] = moveCursorToCorner; m_mDispatchers["movecursortocorner"] = moveCursorToCorner;
m_mDispatchers["workspaceopt"] = workspaceOpt; m_mDispatchers["workspaceopt"] = workspaceOpt;
m_mDispatchers["exit"] = exitHyprland;
} }
void CKeybindManager::addKeybind(SKeybind kb) { void CKeybindManager::addKeybind(SKeybind kb) {
@ -675,3 +676,8 @@ void CKeybindManager::workspaceOpt(std::string args) {
// recalc mon // recalc mon
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(g_pCompositor->m_pLastMonitor->ID); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(g_pCompositor->m_pLastMonitor->ID);
} }
void CKeybindManager::exitHyprland(std::string argz) {
g_pCompositor->cleanupExit();
exit(0);
}

View file

@ -50,6 +50,7 @@ private:
static void toggleSplit(std::string); static void toggleSplit(std::string);
static void moveCursorToCorner(std::string); static void moveCursorToCorner(std::string);
static void workspaceOpt(std::string); static void workspaceOpt(std::string);
static void exitHyprland(std::string);
}; };
inline std::unique_ptr<CKeybindManager> g_pKeybindManager; inline std::unique_ptr<CKeybindManager> g_pKeybindManager;