From fa39f67eab9af470cc815a8900806567cd966721 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 6 Jan 2012 14:02:54 +0000 Subject: [PATCH] actor: Use g_clear_object() GLib has a nice, atomic object clearing function that allows us to drop code looking like: if (priv->object != NULL) { g_object_unref (priv->object); priv->object = NULL; } from the ::dispose implementation. --- clutter/clutter-actor.c | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 1f7a25909..2b2d096d3 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -3740,35 +3740,11 @@ clutter_actor_dispose (GObject *object) g_assert (!CLUTTER_ACTOR_IS_REALIZED (self)); } - if (priv->pango_context) - { - g_object_unref (priv->pango_context); - priv->pango_context = NULL; - } - - if (priv->actions != NULL) - { - g_object_unref (priv->actions); - priv->actions = NULL; - } - - if (priv->constraints != NULL) - { - g_object_unref (priv->constraints); - priv->constraints = NULL; - } - - if (priv->effects != NULL) - { - g_object_unref (priv->effects); - priv->effects = NULL; - } - - if (priv->flatten_effect != NULL) - { - g_object_unref (priv->flatten_effect); - priv->flatten_effect = NULL; - } + g_clear_object (&priv->pango_context); + g_clear_object (&priv->actions); + g_clear_object (&priv->constraints); + g_clear_object (&priv->effects); + g_clear_object (&priv->flatten_effect); g_signal_emit (self, actor_signals[DESTROY], 0);