From 9048af7d21a817a8068d4b5731297b6f03ecc7e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B8rgen=20Lind?= Date: Thu, 19 Apr 2012 22:51:28 +0200 Subject: [PATCH] Fix compositor crash when closing windows with subsurfaces Change-Id: I91b93cbd1ffcce6f60e44600a02f14f59813fccc Reviewed-by: Laszlo Agocs --- src/compositor/wayland_wrapper/wlsubsurface.cpp | 9 +++++++++ src/compositor/wayland_wrapper/wlsubsurface.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/compositor/wayland_wrapper/wlsubsurface.cpp b/src/compositor/wayland_wrapper/wlsubsurface.cpp index 379c23c..9108f12 100644 --- a/src/compositor/wayland_wrapper/wlsubsurface.cpp +++ b/src/compositor/wayland_wrapper/wlsubsurface.cpp @@ -41,6 +41,7 @@ #include "wlsubsurface.h" #include "wlcompositor.h" +#include "waylandsurface.h" namespace Wayland { @@ -87,6 +88,10 @@ SubSurface::~SubSurface() if (m_parent) { m_parent->removeSubSurface(this); } + QLinkedList::iterator it; + for (it = m_sub_surfaces.begin(); it != m_sub_surfaces.end(); ++it) { + (*it)->handle()->subSurface()->parentDestroyed(); + } } void SubSurface::setSubSurface(SubSurface *subSurface, int x, int y) @@ -134,6 +139,10 @@ QLinkedList SubSurface::subSurfaces() const return m_sub_surfaces; } +void SubSurface::parentDestroyed() +{ + m_parent = 0; +} void SubSurface::attach_sub_surface(wl_client *client, wl_resource *sub_surface_parent_resource, wl_resource *sub_surface_child_resource, int32_t x, int32_t y) { Q_UNUSED(client); diff --git a/src/compositor/wayland_wrapper/wlsubsurface.h b/src/compositor/wayland_wrapper/wlsubsurface.h index ab4f205..966e93f 100644 --- a/src/compositor/wayland_wrapper/wlsubsurface.h +++ b/src/compositor/wayland_wrapper/wlsubsurface.h @@ -88,6 +88,7 @@ public: WaylandSurface *waylandSurface() const; private: + void parentDestroyed(); struct wl_resource *m_sub_surface_resource; Surface *m_surface; -- 2.7.4