From b3f27de71019d8a812ec4587444a328aa7dbc8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 24 Aug 2016 14:02:33 +0800 Subject: [PATCH] wayland/subsurface: Return NULL as toplevel if parent has no role There is nothing stopping a subsurface from commiting its state before its parents role has been assigned. Thus, we need to handle meta_wayland_surface_get_toplevel() returning NULL for subsurfaces even on commit. --- src/wayland/meta-wayland-surface.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 54cdcc9e2..5ce2b397c 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -594,7 +594,10 @@ subsurface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role) meta_wayland_surface_role_get_surface (surface_role); MetaWaylandSurface *parent = surface->sub.parent; - return meta_wayland_surface_role_get_toplevel (parent->role); + if (parent->role) + return meta_wayland_surface_role_get_toplevel (parent->role); + else + return NULL; } /* A non-subsurface is always desynchronized.