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>
This commit is contained in:
Olivier Fourdan 2016-02-29 10:14:56 +01:00 committed by Matthias Clasen
parent 9e2207b2b0
commit de383809f6

View File

@ -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;