aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTom Englund <[email protected]>2024-08-23 15:06:52 +0200
committerGitHub <[email protected]>2024-08-23 14:06:52 +0100
commitdf4f222482a7c2a1116ef5c91ba6e4b55d94ad6c (patch)
treeed47f3192efa7add962237d5af647af1f42deb41
parent3b663f4afcecb1abc93a61d6448183c5978f5cd2 (diff)
downloadHyprland-df4f222482a7c2a1116ef5c91ba6e4b55d94ad6c.tar.gz
Hyprland-df4f222482a7c2a1116ef5c91ba6e4b55d94ad6c.zip
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.
-rw-r--r--src/desktop/LayerSurface.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp
index 8fd448ef..46aea86c 100644
--- a/src/desktop/LayerSurface.cpp
+++ b/src/desktop/LayerSurface.cpp
@@ -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)