Hi netanel,

On Thu, Nov 5, 2015 at 11:26 AM, Netanel M. <[email protected]>
wrote:

> I'm getting crashes every few minutes. It happens when I try to remove a
> child from a batchnode. I'm getting these errors:
> Exception: Child not found: <cocos.sprite.Sprite object at 0x0C8E3E90>
>
>
> ...


> I have no idea what's wrong here, my code seems fine. and the issue only
> rises sometimes, usually it's okay. so maybe there's a memory leak here,
> coming from the batchnode code?
> Or maybe I'm using batchnodes incorrectly. is it okay to add and remove
> objects from different update functions? or are they not thread safe?
> Has anyone else had this problem?
>


I think it its safe to call add - remove from different update functions
**in the main thread**, the one that runs on_draw.

It is not thread-safe.

If you are using threads, then I cannot suggest anything specific without
more details; a working reduced bugdemo would reduce a lot the time to
communicate what exactly the situation is.

Some discussion about how to use threads had come to the list [0], examples
posted that can help to make a bugdemo tailored to your situation.

To answer your question in your follow-up mail, I think you can remove from
a batchnode within a CallFunc if the CallFunc runs in the main thread.

[0]
http://search.gmane.org/search.php?group=gmane.comp.python.cocos2d.user&query=thread

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to