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.
This commit is contained in:
Emmanuele Bassi 2012-01-06 14:02:54 +00:00
parent 88aaad9bdf
commit fa39f67eab

View File

@ -3740,35 +3740,11 @@ clutter_actor_dispose (GObject *object)
g_assert (!CLUTTER_ACTOR_IS_REALIZED (self)); g_assert (!CLUTTER_ACTOR_IS_REALIZED (self));
} }
if (priv->pango_context) g_clear_object (&priv->pango_context);
{ g_clear_object (&priv->actions);
g_object_unref (priv->pango_context); g_clear_object (&priv->constraints);
priv->pango_context = NULL; g_clear_object (&priv->effects);
} g_clear_object (&priv->flatten_effect);
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_signal_emit (self, actor_signals[DESTROY], 0); g_signal_emit (self, actor_signals[DESTROY], 0);