Skip to content

Commit

Permalink
pointermgr: ensure compositor exist on destroy (#6216)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gulafaran authored May 23, 2024
1 parent eea0a6a commit 4e42107
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/managers/PointerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

Expand Down

0 comments on commit 4e42107

Please sign in to comment.