[mutter] wayland/subsurface: Return NULL as toplevel if parent has no role



commit b3f27de71019d8a812ec4587444a328aa7dbc8ad
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Aug 24 14:02:33 2016 +0800

    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 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 54cdcc9..5ce2b39 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.


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