pointermgr: ensure compositor exist on destroy (#6216)

on exit of hyprland the CMonitor destroy signal comes after the
compositor has been destructed, causing a heap use after free. add if
check to ensure compositor exist and isnt shutting down when its
triggered.
This commit is contained in:
Tom Englund 2024-05-23 21:19:14 +02:00 committed by GitHub
parent eea0a6a704
commit 4e42107d25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -131,7 +131,11 @@ CPointerManager::CPointerManager() {
PMONITOR->events.modeChanged.registerStaticListener([this](void* owner, std::any data) { onMonitorLayoutChange(); }, nullptr);
PMONITOR->events.disconnect.registerStaticListener([this](void* owner, std::any data) { onMonitorLayoutChange(); }, nullptr);
PMONITOR->events.destroy.registerStaticListener(
[this](void* owner, std::any data) { std::erase_if(monitorStates, [](const auto& other) { return other->monitor.expired(); }); }, nullptr);
[this](void* owner, std::any data) {
if (g_pCompositor && !g_pCompositor->m_bIsShuttingDown)
std::erase_if(monitorStates, [](const auto& other) { return other->monitor.expired(); });
},
nullptr);
});
}