summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper/qwlsurface.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-02-26 08:20:37 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-05 14:05:39 +0200
commitc226db9ba3565230fea01d4e3223d82d24d3fb76 (patch)
tree04d662bfcd6f7e70d84aaff18922501f1494b31a /src/compositor/wayland_wrapper/qwlsurface.cpp
parent0bb380f3a9f53dd93fb68a0e65f2f9037520c107 (diff)
Prevent crash when extended surface is destroyed.
The surface is not destroyed synchronously with the extended surface so there is a small chance that something accesses Surface::extendedSurface() between the time when the extended surface is destroyed and the Surface itself is cleaned up. We also want to make sure that the extended surface is not hanging around after the surface is destroyed, so nuke it immediately on surface_destroy_resource. Change-Id: I87eff0b07727f1b528e803a5a617908658665f20 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/compositor/wayland_wrapper/qwlsurface.cpp')
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp
index 7ca58341f..5928bbb0f 100644
--- a/src/compositor/wayland_wrapper/qwlsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurface.cpp
@@ -420,6 +420,12 @@ SurfaceBuffer *Surface::createSurfaceBuffer(struct ::wl_resource *buffer)
void Surface::surface_destroy_resource(Resource *)
{
+ if (m_extendedSurface) {
+ if (m_extendedSurface->resource())
+ wl_resource_destroy(m_extendedSurface->resource()->handle);
+ m_extendedSurface = 0;
+ }
+
compositor()->destroySurface(this);
}