In my code, I destroy an animation instance in the CEGUI::AnimationInstance::EventAnimationEnded handler. This works on my linux build but in my iPhone build the instance is destroyed before it is removed from the AnimationManager. At least, thats what I gather from the debugger... I get a memory error which halts the program in AnimationManager::stepInstances (on the iPhone simulator).
I've been looking at the code and it seems that the Animation Manager stores animation instances as a map Animation* -> AnimationInstance*. It appears that destroyAnimationInstance removes the element from the map. IIRC any time you erase something from a map any current read iterators become invalid. Perhaps this is incidentally not the case in the std::map implementation on my linux system, but is the case for the iPhone system (though they both appear to use red-black tree's for the implementation).
Anyway, whats the best way to destroy animation instances when they are finished?
When is it safe to destroy an animation instance
Moderators: CEGUI MVP, CEGUI Team
-
- Just popping in
- Posts: 8
- Joined: Tue Apr 03, 2012 21:36
Re: When is it safe to destroy an animation instance
You are right, deleting an animation instance while the system is stepping them breaks the iterator.
I think AnimationInstances need a dead pool like Windows have. Are you interested in creating a patch for this?
I think AnimationInstances need a dead pool like Windows have. Are you interested in creating a patch for this?
-
- Just popping in
- Posts: 8
- Joined: Tue Apr 03, 2012 21:36
Re: When is it safe to destroy an animation instance
Should be easy enough. I'll need to do something for my application anyhow since I'm dynamically creating one-off animations. If I can do it cleanly I'll submit a patch.
Who is online
Users browsing this forum: No registered users and 33 guests