From 37719da680462712b975f6b734bdf8aa95df4adf Mon Sep 17 00:00:00 2001
From: Mikko Harju <mikko.harju@jolla.com>
Date: Thu, 25 Jun 2015 15:38:28 +0300
Subject: [PATCH] Reset surface transientParent when the parent is destroyed.

If a transient parent of a surface is destroyed before the surface
itself, reset all references to that parent surface.

Change-Id: I5b748099d8a5502632d8846c5de5381b5f28b665
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
---
 src/compositor/wayland_wrapper/qwlsurface.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp
index 4cadbb590..2b7f21aee 100644
--- a/src/compositor/wayland_wrapper/qwlsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurface.cpp
@@ -408,6 +408,14 @@ void Surface::surface_destroy_resource(Resource *)
         m_extendedSurface = 0;
     }
 
+    if (transientParent()) {
+        foreach (Surface *surface, compositor()->surfaces()) {
+            if (surface->transientParent() == this) {
+                surface->setTransientParent(0);
+            }
+        }
+    }
+
     m_destroyed = true;
     m_waylandSurface->destroy();
     emit m_waylandSurface->surfaceDestroyed();
-- 
GitLab