1
0
Fork 0

compositor: Fix surface accounting at MetaWindowActor

When the actor gets a new "main" surface assigned, it adds the
new surface to the stack of surface actors, but forgets to remove
the old one.

This stale pointer in the array may cause invalid reads and crashes
after the assigned surface is disposed, e.g. when destroying the
MetaWindowActor tries to disconnect signals from all accounted
surface actors.

Fixes: 9a2c8b2592 ("window: Add suspend state")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3252>
This commit is contained in:
Carlos Garnacho 2023-09-06 18:13:00 +02:00
parent 33eef7211a
commit 80e15775a5

View file

@ -367,6 +367,9 @@ meta_window_actor_real_assign_surface_actor (MetaWindowActor *self,
MetaWindowActorPrivate *priv = MetaWindowActorPrivate *priv =
meta_window_actor_get_instance_private (self); meta_window_actor_get_instance_private (self);
if (priv->surface)
meta_window_actor_remove_surface_actor (self, priv->surface);
g_clear_object (&priv->surface); g_clear_object (&priv->surface);
priv->surface = g_object_ref_sink (surface_actor); priv->surface = g_object_ref_sink (surface_actor);