Blame SOURCES/0011-clutter-actor-meta-Unset-the-actor-if-disposed-calli.patch

79df40
From 7a5c4a68c4c80b61566e6c9eeb0e854d5c344dd1 Mon Sep 17 00:00:00 2001
79df40
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
79df40
Date: Sat, 27 Jul 2019 00:28:46 +0200
79df40
Subject: [PATCH 11/28] clutter/actor-meta: Unset the actor if disposed,
79df40
 calling the vfunc
79df40
79df40
If the actor owned by an ActorMeta is destroyed we unset its pointer, however
79df40
many implementations of this class keep a reference on the pointer, so we should
79df40
notify them about the invalid pointer or they might try to reference an invalid
79df40
memory location.
79df40
79df40
Fix this by changing the destroy callback, unsetting the destroy connection id
79df40
and calling _clutter_actor_meta_set_actor()
79df40
79df40
https://gitlab.gnome.org/GNOME/mutter/merge_requests/682
79df40
---
79df40
 clutter/clutter/clutter-actor-meta.c | 3 ++-
79df40
 1 file changed, 2 insertions(+), 1 deletion(-)
79df40
79df40
diff --git a/clutter/clutter/clutter-actor-meta.c b/clutter/clutter/clutter-actor-meta.c
79df40
index 2843ea222..157c1d67e 100644
79df40
--- a/clutter/clutter/clutter-actor-meta.c
79df40
+++ b/clutter/clutter/clutter-actor-meta.c
79df40
@@ -56,61 +56,62 @@ struct _ClutterActorMetaPrivate
79df40
   guint destroy_id;
79df40
 
79df40
   gchar *name;
79df40
 
79df40
   guint is_enabled : 1;
79df40
 
79df40
   gint priority;
79df40
 };
79df40
 
79df40
 enum
79df40
 {
79df40
   PROP_0,
79df40
 
79df40
   PROP_ACTOR,
79df40
   PROP_NAME,
79df40
   PROP_ENABLED,
79df40
 
79df40
   PROP_LAST
79df40
 };
79df40
 
79df40
 static GParamSpec *obj_props[PROP_LAST];
79df40
 
79df40
 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterActorMeta,
79df40
                                      clutter_actor_meta,
79df40
                                      G_TYPE_INITIALLY_UNOWNED)
79df40
 
79df40
 static void
79df40
 on_actor_destroy (ClutterActor     *actor,
79df40
                   ClutterActorMeta *meta)
79df40
 {
79df40
-  meta->priv->actor = NULL;
79df40
+  meta->priv->destroy_id = 0;
79df40
+  _clutter_actor_meta_set_actor (meta, NULL);
79df40
 }
79df40
 
79df40
 static void
79df40
 clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
79df40
                                    ClutterActor     *actor)
79df40
 {
79df40
   if (meta->priv->actor == actor)
79df40
     return;
79df40
 
79df40
   if (meta->priv->destroy_id != 0)
79df40
     {
79df40
       g_signal_handler_disconnect (meta->priv->actor, meta->priv->destroy_id);
79df40
       meta->priv->destroy_id = 0;
79df40
     }
79df40
 
79df40
   meta->priv->actor = actor;
79df40
   g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ACTOR]);
79df40
 
79df40
   if (meta->priv->actor != NULL)
79df40
     meta->priv->destroy_id = g_signal_connect (meta->priv->actor, "destroy",
79df40
                                                G_CALLBACK (on_actor_destroy),
79df40
                                                meta);
79df40
 }
79df40
 
79df40
 static void
79df40
 clutter_actor_meta_set_property (GObject      *gobject,
79df40
                                  guint         prop_id,
79df40
                                  const GValue *value,
79df40
                                  GParamSpec   *pspec)
79df40
 {
79df40
-- 
79df40
2.26.2
79df40