Fix compositor crash when closing windows with subsurfaces
authorJørgen Lind <jorgen.lind@nokia.com>
Thu, 19 Apr 2012 20:51:28 +0000 (22:51 +0200)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>
Tue, 24 Apr 2012 12:04:20 +0000 (14:04 +0200)
Change-Id: I91b93cbd1ffcce6f60e44600a02f14f59813fccc
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
src/compositor/wayland_wrapper/wlsubsurface.cpp
src/compositor/wayland_wrapper/wlsubsurface.h

index 379c23c..9108f12 100644 (file)
@@ -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<WaylandSurface *>::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<WaylandSurface *> 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);
index ab4f205..966e93f 100644 (file)
@@ -88,6 +88,7 @@ public:
     WaylandSurface *waylandSurface() const;
 
 private:
+    void parentDestroyed();
     struct wl_resource *m_sub_surface_resource;
     Surface *m_surface;