[gtk+] wayland: Fix invalid cast in transient_for



commit 7e3e50729f43dc5625f2ae874450b96fa347a106
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Nov 19 12:36:12 2013 -0500

    wayland: Fix invalid cast in transient_for

 gdk/wayland/gdkwindow-wayland.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index e81cad8..08e20af 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -839,16 +839,25 @@ static void
 gdk_wayland_window_sync_transient_for (GdkWindow *window)
 {
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
-  GdkWindowImplWayland *impl_parent = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for);
+  struct wl_surface *transient_for_surface;
 
   if (!impl->xdg_surface)
     return;
 
-  /* XXX: Is this correct? */
-  if (!impl_parent->surface)
-    return;
+  if (impl->transient_for)
+    {
+      GdkWindowImplWayland *impl_parent = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl);
+
+      /* XXX: Is this correct? */
+      if (!impl_parent->surface)
+        return;
+
+      transient_for_surface = impl_parent->surface;
+    }
+  else
+    transient_for_surface = NULL;
 
-  xdg_surface_set_transient_for (impl->xdg_surface, impl_parent->surface);
+  xdg_surface_set_transient_for (impl->xdg_surface, transient_for_surface);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]