[clutter] actor: Use g_clear_object()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] actor: Use g_clear_object()
- Date: Fri, 6 Jan 2012 14:17:19 +0000 (UTC)
commit fa39f67eab9af470cc815a8900806567cd966721
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Fri Jan 6 14:02:54 2012 +0000
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 files changed, 5 insertions(+), 29 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 1f7a259..2b2d096 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]