Hyprland/src/managers/ThreadManager.cpp
Tom Englund e6d10539af
core: fix a few small memory leaks on exit (#6470)
* renderer: add destructor and destroy event source

add destructor and destroy the event source.
one less leak on exit of compositor reported by asan.

* compositor: cleanup eventloop on exit

destruct hyprctl to release the event sources, and properly cleanup the
event loop on exit of compositor. less leaks on exit reported by asan

* threadmgr: destroy event source on destruction

destroy the event source on destruction.

* eventloopmgr: reset eventloopmgr on exit aswell

reset the eventloopmanager on exit of compositor and free the leaking
last idle frame on monitor destroy.
2024-06-13 12:08:02 +02:00

30 lines
No EOL
770 B
C++

#include "ThreadManager.hpp"
#include "../debug/HyprCtl.hpp"
#include "../Compositor.hpp"
#include "../config/ConfigValue.hpp"
int slowUpdate = 0;
int handleTimer(void* data) {
const auto PTM = (CThreadManager*)data;
static auto PDISABLECFGRELOAD = CConfigValue<Hyprlang::INT>("misc:disable_autoreload");
if (*PDISABLECFGRELOAD != 1)
g_pConfigManager->tick();
wl_event_source_timer_update(PTM->m_esConfigTimer, 1000);
return 0;
}
CThreadManager::CThreadManager() {
m_esConfigTimer = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, handleTimer, this);
wl_event_source_timer_update(m_esConfigTimer, 1000);
}
CThreadManager::~CThreadManager() {
if (m_esConfigTimer)
wl_event_source_remove(m_esConfigTimer);
}