summaryrefslogtreecommitdiff
path: root/src/protocols/GlobalShortcuts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocols/GlobalShortcuts.cpp')
-rw-r--r--src/protocols/GlobalShortcuts.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/protocols/GlobalShortcuts.cpp b/src/protocols/GlobalShortcuts.cpp
index b376cae3..898f0e07 100644
--- a/src/protocols/GlobalShortcuts.cpp
+++ b/src/protocols/GlobalShortcuts.cpp
@@ -8,13 +8,20 @@ static void bindManagerInt(wl_client* client, void* data, uint32_t version, uint
}
static void handleDisplayDestroy(struct wl_listener* listener, void* data) {
- g_pProtocolManager->m_pGlobalShortcutsProtocolManager->displayDestroy();
+ CGlobalShortcutsProtocolManager* proto = wl_container_of(listener, proto, m_liDisplayDestroy);
+ proto->displayDestroy();
}
void CGlobalShortcutsProtocolManager::displayDestroy() {
+ wl_list_remove(&m_liDisplayDestroy.link);
+ wl_list_init(&m_liDisplayDestroy.link);
wl_global_destroy(m_pGlobal);
}
+CGlobalShortcutsProtocolManager::~CGlobalShortcutsProtocolManager() {
+ displayDestroy();
+}
+
CGlobalShortcutsProtocolManager::CGlobalShortcutsProtocolManager() {
m_pGlobal = wl_global_create(g_pCompositor->m_sWLDisplay, &hyprland_global_shortcuts_manager_v1_interface, GLOBAL_SHORTCUTS_VERSION, this, bindManagerInt);
@@ -148,4 +155,4 @@ void CGlobalShortcutsProtocolManager::destroyShortcut(wl_resource* resource) {
for (auto& c : m_vClients) {
std::erase_if(c->shortcuts, [&](const auto& other) { return other->resource == resource; });
}
-} \ No newline at end of file
+}