[mutter] compositor: Destroy actors when unmanaging
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] compositor: Destroy actors when unmanaging
- Date: Mon, 7 Feb 2022 18:29:53 +0000 (UTC)
commit 35ac3a096d84de97c1da9a54d99aebf7640c1c07
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Sat Jan 29 00:15:28 2022 +0100
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>
src/compositor/compositor.c | 21 +++++++++++++++------
src/compositor/meta-compositor-server.c | 6 ------
src/compositor/meta-compositor-x11.c | 4 ++++
3 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index e558d48b55..9d8e9dcc95 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -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;
diff --git a/src/compositor/meta-compositor-server.c b/src/compositor/meta-compositor-server.c
index 179dc83ef4..f0d469172c 100644
--- a/src/compositor/meta-compositor-server.c
+++ b/src/compositor/meta-compositor-server.c
@@ -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;
diff --git a/src/compositor/meta-compositor-x11.c b/src/compositor/meta-compositor-x11.c
index a16604640d..61b75026bd 100644
--- a/src/compositor/meta-compositor-x11.c
+++ b/src/compositor/meta-compositor-x11.c
@@ -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);
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]