From c05e2fea45da0f1692a5b1f07a8bd81a9924328b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 30 Mar 2022 14:57:12 +0100 Subject: [PATCH] Guard subsurface parent access. Whilst a subsurface must have a parent at the time of creation, the lifespan is not guaranteed afterwards. It's a weird thing for a client to do, but we need to not crash afterwards. If the parent surface is destroyed we should consider the surface unmapped. BUG: 452044 --- src/wayland/surface_interface.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wayland/surface_interface.cpp b/src/wayland/surface_interface.cpp index f369fe4080..34538532c0 100644 --- a/src/wayland/surface_interface.cpp +++ b/src/wayland/surface_interface.cpp @@ -690,7 +690,13 @@ void SurfaceInterfacePrivate::commitFromCache() bool SurfaceInterfacePrivate::computeEffectiveMapped() const { - return bufferRef && (!subSurface || subSurface->parentSurface()->isMapped()); + if (!bufferRef) { + return false; + } + if (subSurface) { + return subSurface->parentSurface() && subSurface->parentSurface()->isMapped(); + } + return true; } void SurfaceInterfacePrivate::updateEffectiveMapped()