On Tue, 2008-02-26 at 12:19 +0530, varun shrivastava wrote: > hi > i have a doubt regarding retrieving objects from ClutterScript > The docs for clutter_script_get_object says "This function does not > increment the reference count of the returned object." > > Does that mean the object is in floating state and we have to do > g_object_ref and g_object_sink to own the ownership
> or ClutterScript owns a reference to the object and when we do > g_object_unref(script), the objects will be unreferenced automatically > if we haven't done a g_object_ref on object retrieved. what the documentation means is that the ClutterScript will not take any reference on the objects it creates, and the ownership is following the usual rules; this means that actors specified as children will have their ownership already transferred to their parent, and alpha objects will have their ownership already transferred to their behaviours. it also means that top-level objects, such as behaviours and timelines will be unreferenced with the ClutterScript object (which holds the only reference they have when they are constructed). in short: you never need to unref what clutter_script_get_object() returns, as it will be managed by ClutterScript. if you want to unref ClutterScript before the end of the objects lifetime, you just need to keep a reference on the top-level objects (timelines and behaviours) and parent the actors (as alphas can only be created implicitly). ciao, Emmanuele. -- Emmanuele Bassi, OpenedHand Ltd. Unit R, Homesdale Business Centre 216-218 Homesdale Rd., Bromley - BR12QZ http://www.o-hand.com -- To unsubscribe send a mail to [EMAIL PROTECTED]
