On Sun, 2009-03-08 at 02:17 +0200, Michael Boccara wrote: > Hi, > > Sorry if this is a dumb question, or if it was asked 1000 times > before. > > In clutter_actor_set_parent, self ref is incremented. > g_object_ref_sink (self); > priv->parent_actor = parent; > But shouldn't it be the parent actor whose reference should be > incremented ?
no, that would be wrong. > Otherwise, how do you guarantee the validity of the parent_actor > pointer ? at some point, an actor must be parented to a Stage -- which does not have a parent actor (and that's also why you don't incremenent the reference count of the parent). hence, every actor is now owned by the stage at the root of the scenegraph. the parenting process should not be viewed as "reference counting management": that is an implementation detail. when you set the parent of an actor you are effectively saying that the parent now owns the child; in GObject-land this means that the parent takes a reference on the child, and releases is when unparent() is called on the child itself. ciao, Emmanuele. -- Emmanuele Bassi, Intel Open Source Technology Center -- To unsubscribe send a mail to [email protected]
