Emmanuele Bassi wrote:
explosion=g_new0(ClutterActor,1);

eek, what is this? you don't need to allocate a ClutterActor with
g_new0().


No, I probably didn't 'need' to, but it did seem to make any difference whether I did or didn't use g_new0 with a texture. It crashes.

As mentioned, if I replace the texture with text as the actor then everything is fine -- even with g_new0.

Besides, if I wanted to have more than one of my explosions could I not use g_new0? And then what happens if I want to get rid of them? I usually use malloc but have been playing with g_new0 as I have seen others use it elsewhere.
pixb = gdk_pixbuf_new_from_file ("images/explosion.png", NULL);

you should really check the return value and/or pass a GError location
to this function; it shouldn't really matter but it's a best practise.


In the real code I did as you suggested, I was attempting to be as brief as possible in my example. The picture loads fine -- no error.


clutter_group_add (CLUTTER_GROUP(stage), explosion);

this should really be:

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), explosion);
clutter_actor_set_position (explosion, 200,300);
clutter_actor_show (explosion); clutter_actor_destroy (explosion);"/


I'll see if that makes any difference to the problem at hand.

and why are you destroying the texture? unless you want to remove it
from the container, which should really be done with
clutter_container_remove() anyway.

I'm destroying it because I want it gone for good -- it served a purpose and now I no longer need it. If I only remove it would it still be lingering in the background somewhere?

I guess I just want to know that if I created 1 or 10000 textures (or more) that they are not going to be hanging around off stage long after they have served their purpose, which is why I wanted to destroy them.
this is hardly working code - let alone meaningful code. could you
please write a small working example that exhibits the crash? also it
would be better to attach a backtrace of the segmentation fault obtained
with gdb.

ciao,
 Emmanuele.

I'll draw up a more full example and try out some of your suggestions to see if the results are the same.

The original code where I discovered the problem spreads this activity out over several areas, so I had drawn up the more simple (and as you aptly put it, "meaningless") example that I then pasted into part of my application where it could be tested in isolation, which is basically the excerpt I had sent to the mailing list, less setting up the stage, calling clutter_main and so forth.

Cheers,

Kevin

--
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to