[gtk+] wayland: Check actual impl type in transient loop



commit de383809f668ae5670777f2219532c66bddec72a
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Mon Feb 29 10:14:56 2016 +0100

    wayland: Check actual impl type in transient loop
    
    If the parent of a transient is not a native Wayland window (e.g.
    offscreen window), the transient loop check will crash.
    
    Check for the actual type in the transient loop check and do not assume
    the parent is necessarily Wayland native.
    
    bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=761156
    
    Signed-off-by: Olivier Fourdan <ofourdan redhat com>

 gdk/wayland/gdkwindow-wayland.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 34c6805..9439c1a 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -946,8 +946,12 @@ gdk_wayland_window_update_dialogs (GdkWindow *window)
   for (l = orphan_dialogs; l; l = l->next)
     {
       GdkWindow *w = l->data;
-      GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (w->impl);
+      GdkWindowImplWayland *impl;
+
+      if (!GDK_IS_WINDOW_IMPL_WAYLAND(w->impl))
+        continue;
 
+      impl = GDK_WINDOW_IMPL_WAYLAND (w->impl);
       if (w == window)
        continue;
       if (impl->hint != GDK_WINDOW_TYPE_HINT_DIALOG)
@@ -2215,8 +2219,12 @@ check_transient_for_loop (GdkWindow *window,
 {
   while (parent)
     {
-      GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl);
+      GdkWindowImplWayland *impl;
+
+      if (!GDK_IS_WINDOW_IMPL_WAYLAND(parent->impl))
+        return FALSE;
 
+      impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl);
       if (impl->transient_for == window)
         return TRUE;
       parent = impl->transient_for;


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