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.
This commit is contained in:
Jonas Ådahl 2016-08-24 14:02:33 +08:00
parent 4cf14c41ef
commit b3f27de710

View File

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