1
0
Fork 0

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));
}
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);