compositor: cleanup fading out on expired monitor

hotplugging monitor can leave fading out windows forever stuck in the
containers, check if they have a expired monitor and remove them aswell.
This commit is contained in:
Tom Englund 2026-02-02 20:39:18 +01:00
parent db6114c6c5
commit 30f26893a2

View file

@ -1288,10 +1288,18 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
}
void CCompositor::cleanupFadingOut(const MONITORID& monid) {
bool windowsFadingDirty = false;
for (auto const& ww : m_windowsFadingOut) {
auto w = ww.lock();
if (!w || !w->m_monitor) {
windowsFadingDirty = true;
Log::logger->log(Log::DEBUG, "Cleanup: m_windowsFadingOut had expired window or monitor");
continue;
}
if (w->monitorID() != monid && w->m_monitor)
continue;
@ -1311,14 +1319,18 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) {
}
}
if (windowsFadingDirty)
std::erase_if(m_windowsFadingOut, [](const auto& el) { return el.expired() || !el->m_monitor; });
bool layersDirty = false;
for (auto const& lsr : m_surfacesFadingOut) {
auto ls = lsr.lock();
if (!ls) {
if (!ls || !ls->m_monitor) {
layersDirty = true;
Log::logger->log(Log::DEBUG, "Cleanup: m_surfacesFadingOut had expired layer or monitor");
continue;
}
@ -1349,8 +1361,10 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) {
}
}
if (layersDirty)
std::erase_if(m_surfacesFadingOut, [](const auto& el) { return el.expired(); });
if (layersDirty) {
std::erase_if(m_surfacesFadingOut, [](const auto& el) { return el.expired() || !el->m_monitor; });
std::erase_if(m_layers, [](const auto& el) { return !el->m_monitor; });
}
}
void CCompositor::addToFadingOutSafe(PHLLS pLS) {