[mutter/gnome-3-34] wayland/surface-actor: Reset and sync subsurface state when resetting



commit 1671692590ab51d492abe9b704cf3ef203c414a8
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Dec 6 18:43:04 2019 +0100

    wayland/surface-actor: Reset and sync subsurface state when resetting
    
    A actor surface may be reset by an xdg_toplevel if a NULL buffer is
    attached. This should reset the actor state of the toplevel to an empty
    state, while unmapping the previous actor. Subsurfaces, however, should
    stay intact, including their relationship to the toplevel. They should
    also not be yanked away from the actor of the actor surface prior to it
    resetting, so that a window-destroy animation can include the subsurface
    actor.
    
    This fixes a potential crash when a subsurface tries to commit to its
    wl_surface after the destroy animation of the toplevel has finished, as
    the actor would at that point have been destroyed and cleared from the
    actor surface struct, causing a segmentation fault.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
    (cherry picked from commit fe7bece31e9462b8018f7d9cc5122dcb23ece2cd)

 src/wayland/meta-wayland-actor-surface.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c
index f929ff446..0ded7f55e 100644
--- a/src/wayland/meta-wayland-actor-surface.c
+++ b/src/wayland/meta-wayland-actor-surface.c
@@ -348,6 +348,16 @@ meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface)
     meta_wayland_actor_surface_get_instance_private (actor_surface);
   MetaWaylandSurface *surface =
     meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (actor_surface));
+  MetaWaylandSurface *subsurface_surface;
+
+  META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (surface, subsurface_surface)
+    {
+      MetaWaylandActorSurface *actor_surface;
+
+      actor_surface = META_WAYLAND_ACTOR_SURFACE (subsurface_surface->role);
+      meta_wayland_actor_surface_reset_actor (actor_surface);
+      meta_wayland_actor_surface_sync_actor_state (actor_surface);
+    }
 
   clear_surface_actor (actor_surface);
 


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