compositor: Destroy actors when unmanaging

When disposing, actors being destroyed might want to access the disposed
compositor; avoid that by destroying them earlier.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2264>
This commit is contained in:
Jonas Ådahl 2022-01-29 00:15:28 +01:00 committed by Marge Bot
parent dd14592314
commit 35ac3a096d
3 changed files with 19 additions and 12 deletions

View File

@ -450,6 +450,20 @@ meta_compositor_manage (MetaCompositor *compositor)
g_error ("Compositor failed to manage display: %s", error->message);
}
static void
meta_compositor_real_unmanage (MetaCompositor *compositor)
{
MetaCompositorPrivate *priv =
meta_compositor_get_instance_private (compositor);
g_clear_signal_handler (&priv->top_window_actor_destroy_id,
priv->top_window_actor);
g_clear_pointer (&priv->window_group, clutter_actor_destroy);
g_clear_pointer (&priv->top_window_group, clutter_actor_destroy);
g_clear_pointer (&priv->feedback_group, clutter_actor_destroy);
}
void
meta_compositor_unmanage (MetaCompositor *compositor)
{
@ -1118,12 +1132,6 @@ meta_compositor_dispose (GObject *object)
g_clear_signal_handler (&priv->before_paint_handler_id, stage);
g_clear_signal_handler (&priv->after_paint_handler_id, stage);
g_clear_signal_handler (&priv->top_window_actor_destroy_id,
priv->top_window_actor);
g_clear_pointer (&priv->window_group, clutter_actor_destroy);
g_clear_pointer (&priv->top_window_group, clutter_actor_destroy);
g_clear_pointer (&priv->feedback_group, clutter_actor_destroy);
g_clear_pointer (&priv->windows, g_list_free);
G_OBJECT_CLASS (meta_compositor_parent_class)->dispose (object);
@ -1139,6 +1147,7 @@ meta_compositor_class_init (MetaCompositorClass *klass)
object_class->constructed = meta_compositor_constructed;
object_class->dispose = meta_compositor_dispose;
klass->unmanage = meta_compositor_real_unmanage;
klass->remove_window = meta_compositor_real_remove_window;
klass->before_paint = meta_compositor_real_before_paint;
klass->after_paint = meta_compositor_real_after_paint;

View File

@ -33,11 +33,6 @@ meta_compositor_server_manage (MetaCompositor *compositor,
return TRUE;
}
static void
meta_compositor_server_unmanage (MetaCompositor *compositor)
{
}
static int64_t
meta_compositor_server_monotonic_to_high_res_xserver_time (MetaCompositor *compositor,
int64_t monotonic_time_us)
@ -92,7 +87,6 @@ meta_compositor_server_class_init (MetaCompositorServerClass *klass)
MetaCompositorClass *compositor_class = META_COMPOSITOR_CLASS (klass);
compositor_class->manage = meta_compositor_server_manage;
compositor_class->unmanage = meta_compositor_server_unmanage;
compositor_class->monotonic_to_high_res_xserver_time =
meta_compositor_server_monotonic_to_high_res_xserver_time;
compositor_class->grab_begin = meta_compositor_server_grab_begin;

View File

@ -209,6 +209,7 @@ meta_compositor_x11_unmanage (MetaCompositor *compositor)
MetaX11Display *x11_display = display->x11_display;
Display *xdisplay = x11_display->xdisplay;
Window xroot = x11_display->xroot;
MetaCompositorClass *parent_class;
/*
* This is the most important part of cleanup - we have to do this before
@ -216,6 +217,9 @@ meta_compositor_x11_unmanage (MetaCompositor *compositor)
* able to redirect subwindows
*/
XCompositeUnredirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
parent_class = META_COMPOSITOR_CLASS (meta_compositor_x11_parent_class);
parent_class->unmanage (compositor);
}
/*