[clutter] clutter_actor_destroy

2008-06-18 Thread Peter Csaszar
Hi,

By the way, I found that clutter_actor_destroy calls
clutter_actor_unparent only if the parent is a container. If the parent
is just an other actor (so it is a composite one) clutter_actor_unparent
is not called on the child. However g_object_dipose is called in both case.

Is this intensional? I am just worry about to call dispose on an actor
we are still using as child of other. Or we just should not use
clutter_actor_destroy for actors in use by some parent actor? Or may be
I missed something?

Br,
Peter Csaszar







smime.p7s
Description: S/MIME Cryptographic Signature


RE: [clutter] Unrefrencing

2008-06-18 Thread Emmanuele Bassi
On Wed, 2008-06-18 at 13:58 +0800, HASWANI HARISH-VCKR47 wrote:
> Hi All,
> 
> Here is my confusion : ptr is an actor, which is added to stage. 
> Later on unreferenced and initialized with new texture. After adding new 
> texture, I am adding again this ptr to stage.
> Here is code: 
> 
> 
> ClutterActor *ptr=clutter_texture_new_from_pixbuf(pixbuf);

as soon as you add an actor to a container, the container takes
ownership of the actor and ptr can be assigned to whatever other actor
you want.

> .
> .
> g_object_unref(G_OBJECT(ptr))

no, you can't do this: you don't own the actor anymore. you actually
never did, as the actor has a "floating reference" which is sunk by the
container.

> ptr=clutter_texture_new_from_pixbuf(pixbuf1);

if you are replacing the texture, you need to destroy the previous
texture actor with:

  clutter_actor_destroy (texture);

and then create a new texture and add it to the stage;
clutter_actor_destroy() will take care of removing the actor for you and
of disposing it.

if you are merely replacing the image inside the texture, use:

  clutter_texture_set_pixbuf (texture, pixbuf1);

which will make things simpler.

> Issue : when I am executing this piece of code. I am getting  this error: 
> (./test-behave:530): Clutter-CRITICAL **: clutter_actor_paint: assertion 
> `CLUTTE
> R_IS_ACTOR (self)' failed
> 
> Please tell me where I am goofing up.

you are goofing up in your lack of reading the documentation of Clutter
and the documentation of GObject. please: read the documentation.

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]