From d5bf15387ad3b4ee36cae7a3cd9f4a9c28790f2e Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Fri, 3 May 2024 15:42:08 +0200 Subject: internal: fix a few asan reported leaks on exit of hyprland (#5852) * notifications: free cairo images on destruction asan reports a leak on exit if we dont free the image we created in the draw function. add a destructor and free images on exit. * compositor: destroy wlroots types on exit there are a few types not being destroyed on exit and causing a leak on exit in wlroots reported by asan, add those. * cursormgr: ensure we destroy cursor mgr on exit add a destructor and call wlr_xcursor_manager_destroy on the manager on destruction, leak reported by asan. * keybindmgr: free state and keymap add missing keymap_unref on creation, and add a destructor and free the state on exit. leak reported by asan. * skeyboard: add destructor and free state free the state on destruction of keyboard, reported as leak by asan --- src/managers/KeybindManager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/managers/KeybindManager.cpp') diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 1150ac2e..cfad932a 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -116,6 +116,11 @@ CKeybindManager::CKeybindManager() { }); } +CKeybindManager::~CKeybindManager() { + if (m_pXKBTranslationState) + xkb_state_unref(m_pXKBTranslationState); +} + void CKeybindManager::addKeybind(SKeybind kb) { m_lKeybinds.push_back(kb); @@ -219,6 +224,7 @@ void CKeybindManager::updateXKBTranslationState() { xkb_context_unref(PCONTEXT); m_pXKBTranslationState = xkb_state_new(PKEYMAP); + xkb_keymap_unref(PKEYMAP); } bool CKeybindManager::ensureMouseBindState() { -- cgit v1.2.3