diff options
author | Robert Mader <robert.mader@posteo.de> | 2021-08-06 13:09:04 +0200 |
---|---|---|
committer | Marge Bot <marge-bot@gnome.org> | 2021-09-02 21:14:18 +0000 |
commit | dd416dd3e2eecfe1f0d3c396d0c5b323ce493168 (patch) | |
tree | 58b535819657903f387e90d02ef6a11eb4aa80c5 | |
parent | f41696b0fc96227ab82c2f417198353fe11922e6 (diff) | |
download | mutter-dd416dd3e2eecfe1f0d3c396d0c5b323ce493168.tar.gz |
window-actor/wayland: Remove subsurface actors on dispose
Destroying the window actor also destroys all its children. Subsurfaces
however may get reused. If the client did not unparent them before
the window actor got destroyed, they will be left without actor
which results in a crash.
Unparent all actors of subsurfaces on dispose to avoid that.
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1892
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1958>
-rw-r--r-- | src/compositor/meta-window-actor-wayland.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c index b1fe61641..641c924db 100644 --- a/src/compositor/meta-window-actor-wayland.c +++ b/src/compositor/meta-window-actor-wayland.c @@ -150,9 +150,32 @@ meta_window_actor_wayland_can_freeze_commits (MetaWindowActor *actor) } static void +meta_window_actor_wayland_dispose (GObject *object) +{ + MetaWindowActor *window_actor = META_WINDOW_ACTOR (object); + MetaSurfaceActor *surface_actor = + meta_window_actor_get_surface (window_actor); + GList *children; + GList *l; + + children = clutter_actor_get_children (CLUTTER_ACTOR (window_actor)); + for (l = children; l; l = l->next) + { + ClutterActor *child_actor = l->data; + + if (META_IS_SURFACE_ACTOR_WAYLAND (child_actor) && + child_actor != CLUTTER_ACTOR (surface_actor)) + clutter_actor_remove_child (CLUTTER_ACTOR (window_actor), child_actor); + } + + G_OBJECT_CLASS (meta_window_actor_wayland_parent_class)->dispose (object); +} + +static void meta_window_actor_wayland_class_init (MetaWindowActorWaylandClass *klass) { MetaWindowActorClass *window_actor_class = META_WINDOW_ACTOR_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); window_actor_class->assign_surface_actor = meta_window_actor_wayland_assign_surface_actor; window_actor_class->frame_complete = meta_window_actor_wayland_frame_complete; @@ -163,6 +186,8 @@ meta_window_actor_wayland_class_init (MetaWindowActorWaylandClass *klass) window_actor_class->set_frozen = meta_window_actor_wayland_set_frozen; window_actor_class->update_regions = meta_window_actor_wayland_update_regions; window_actor_class->can_freeze_commits = meta_window_actor_wayland_can_freeze_commits; + + object_class->dispose = meta_window_actor_wayland_dispose; } static void |