layersurface: remove layer on destroy from monitor (#7457)

remove destroyed layer weakptrs on destroy, we can hit multiple
null ptr derefs in renderering on mirroring and unmirroring displays
otherwise.
This commit is contained in:
Tom Englund 2024-08-23 15:06:52 +02:00 committed by GitHub
parent 3b663f4afc
commit df4f222482
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -107,6 +107,12 @@ void CLayerSurface::onDestroy() {
g_pHyprRenderer->damageBox(&geomFixed);
}
for (auto& mon : g_pCompositor->m_vRealMonitors) {
for (auto& lsl : mon->m_aLayerSurfaceLayers) {
std::erase_if(lsl, [this](auto& ls) { return ls.expired() || ls.get() == this; });
}
}
readyToDelete = true;
layerSurface.reset();
if (surface)