From de383809f668ae5670777f2219532c66bddec72a Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 29 Feb 2016 10:14:56 +0100 Subject: [PATCH] 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 --- gdk/wayland/gdkwindow-wayland.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 34c6805ce8..9439c1abc6 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;