From 95d3e0f962a896bdfa24945b50e82ccd6d4e1495 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 6 Jan 2012 14:04:43 +0000 Subject: [PATCH] actor: Change the point of emission of ::destroy Currently, we're emitting the ClutterActor::destroy at the end of the dispose implementation - right before we chain up to the parent implementation. The point of emission makes the ::destroy signal handlers able to just use the actor pointer - as the actor state will have been mostly cleared by the time application can run. This (undocumented) behaviour severely limits the amount of things you can do inside a ::destroy signal handler, thus making the ::destroy signal just a weird weak reference, instead of a proper way to break application reference cycles. Given that this change relaxes some of the conditions, this change should be safe - obviously, if anything happens, we'll back it out; the conformance and interactive tests confirm that, for common patterns of usage, this change does not break existing code. --- clutter/clutter-actor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 2b2d096d3..8c71328a3 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -3713,6 +3713,8 @@ clutter_actor_dispose (GObject *object) g_type_name (G_OBJECT_TYPE (self)), object->ref_count); + g_signal_emit (self, actor_signals[DESTROY], 0); + /* avoid recursing when called from clutter_actor_destroy() */ if (priv->parent_actor != NULL) { @@ -3746,8 +3748,6 @@ clutter_actor_dispose (GObject *object) g_clear_object (&priv->effects); g_clear_object (&priv->flatten_effect); - g_signal_emit (self, actor_signals[DESTROY], 0); - G_OBJECT_CLASS (clutter_actor_parent_class)->dispose (object); }