[clutter] actor: NULL-ify sibling fields when removing



commit 29384c114f5c27b47ce074e7fd36fea4d40a25dc
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Fri Jan 20 17:15:20 2012 +0000

    actor: NULL-ify sibling fields when removing
    
    Let's try and avoid leaving around stale pointers.

 clutter/clutter-actor.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 154ef00..677ac39 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -9499,6 +9499,9 @@ insert_child_at_depth (ClutterActor *self,
       self->priv->first_child = child;
       self->priv->last_child = child;
 
+      child->priv->next_sibling = NULL;
+      child->priv->prev_sibling = NULL;
+
       return;
     }
 
@@ -9749,6 +9752,8 @@ clutter_actor_add_child_internal (ClutterActor              *self,
 
   g_object_ref_sink (child);
   child->priv->parent = self;
+  child->priv->next_sibling = NULL;
+  child->priv->prev_sibling = NULL;
 
   /* delegate the actual insertion */
   add_func (self, child, data);
@@ -9993,7 +9998,8 @@ clutter_actor_set_parent (ClutterActor *self,
    * emit the ::actor-added signal, to avoid recursion or double
    * emissions
    */
-  clutter_actor_add_child_internal (parent, self, ADD_CHILD_LEGACY_FLAGS,
+  clutter_actor_add_child_internal (parent, self,
+                                    ADD_CHILD_LEGACY_FLAGS,
                                     insert_child_at_depth,
                                     NULL);
 }
@@ -10072,6 +10078,9 @@ remove_child (ClutterActor *self,
 
   if (self->priv->last_child == child)
     self->priv->last_child = prev_sibling;
+
+  child->priv->prev_sibling = NULL;
+  child->priv->next_sibling = NULL;
 }
 
 typedef enum {



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