From d4b6d9e3190e2cae30fb5bbc41a76286bbed0214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 27 Jul 2019 00:20:55 +0200 Subject: [PATCH 10/28] clutter/actor-meta: Notify when actor property changed The ActorMeta contains an actor property holding the parent actor, however when it changes no notification is emitted. Other tham this, since the set_actor vfunc is called on meta destruction, it could be a problem if the virtual function is implemented by a Javascript object since the JS context will try to use it during its disposition. https://gitlab.gnome.org/GNOME/mutter/merge_requests/682 --- clutter/clutter/clutter-actor-meta.c | 1 + 1 file changed, 1 insertion(+) diff --git a/clutter/clutter/clutter-actor-meta.c b/clutter/clutter/clutter-actor-meta.c index 085f2f65d..2843ea222 100644 --- a/clutter/clutter/clutter-actor-meta.c +++ b/clutter/clutter/clutter-actor-meta.c @@ -73,60 +73,61 @@ enum PROP_LAST }; static GParamSpec *obj_props[PROP_LAST]; G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterActorMeta, clutter_actor_meta, G_TYPE_INITIALLY_UNOWNED) static void on_actor_destroy (ClutterActor *actor, ClutterActorMeta *meta) { meta->priv->actor = NULL; } static void clutter_actor_meta_real_set_actor (ClutterActorMeta *meta, ClutterActor *actor) { if (meta->priv->actor == actor) return; if (meta->priv->destroy_id != 0) { g_signal_handler_disconnect (meta->priv->actor, meta->priv->destroy_id); meta->priv->destroy_id = 0; } meta->priv->actor = actor; + g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ACTOR]); if (meta->priv->actor != NULL) meta->priv->destroy_id = g_signal_connect (meta->priv->actor, "destroy", G_CALLBACK (on_actor_destroy), meta); } static void clutter_actor_meta_set_property (GObject *gobject, guint prop_id, const GValue *value, GParamSpec *pspec) { ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject); switch (prop_id) { case PROP_NAME: clutter_actor_meta_set_name (meta, g_value_get_string (value)); break; case PROP_ENABLED: clutter_actor_meta_set_enabled (meta, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } } -- 2.26.2