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 fe7bece31e)
This commit is contained in:
Jonas Ådahl 2019-12-06 18:43:04 +01:00
parent 06fc756f0f
commit 1671692590

View File

@ -348,6 +348,16 @@ meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface)
meta_wayland_actor_surface_get_instance_private (actor_surface); meta_wayland_actor_surface_get_instance_private (actor_surface);
MetaWaylandSurface *surface = MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (actor_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); clear_surface_actor (actor_surface);