[clutter/clutter-1.10] actor: Clear MetaGroups when empty



commit 89ab7bbb7e6b15dc79fb17faaf9f92079165fd50
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Apr 12 17:04:57 2012 +0100

    actor: Clear MetaGroups when empty
    
    When removing the last Action, Constraint, or Effect, we should also be
    clearing the corresponding MetaGroup: code inside ClutterActor relies on
    NULL checks, and changing them all to check for NULL && n_items == 0
    would not be fun.

 clutter/clutter-actor.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index e46a9a7..a0932c3 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -3241,6 +3241,9 @@ _clutter_actor_remove_effect_internal (ClutterActor  *self,
     return;
 
   _clutter_meta_group_remove_meta (priv->effects, CLUTTER_ACTOR_META (effect));
+
+  if (_clutter_meta_group_peek_metas (priv->effects) == NULL)
+    g_clear_object (&priv->effects);
 }
 
 static gboolean
@@ -14768,6 +14771,9 @@ clutter_actor_remove_action (ClutterActor  *self,
 
   _clutter_meta_group_remove_meta (priv->actions, CLUTTER_ACTOR_META (action));
 
+  if (_clutter_meta_group_peek_metas (priv->actions) == NULL)
+    g_clear_object (&priv->actions);
+
   g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIONS]);
 }
 
@@ -14971,6 +14977,10 @@ clutter_actor_remove_constraint (ClutterActor      *self,
 
   _clutter_meta_group_remove_meta (priv->constraints,
                                    CLUTTER_ACTOR_META (constraint));
+
+  if (_clutter_meta_group_peek_metas (priv->constraints) == NULL)
+    g_clear_object (&priv->constraints);
+
   clutter_actor_queue_relayout (self);
 
   g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONSTRAINTS]);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]