From 6dcf73adaafeaa40c05e22df5f1c10af88df362b 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 (cherry picked from commit 1d2424a56a13dc55aeab699a38234a7cafa091d8) --- src/server/surface_interface.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/surface_interface.cpp b/src/server/surface_interface.cpp index ef2584f4..8bfac95f 100644 --- a/src/server/surface_interface.cpp +++ b/src/server/surface_interface.cpp @@ -678,7 +678,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() -- GitLab