Hello,
I am running into the following issue and am not entirely sure why.
Essentially, I have a class derived from AtlasSprite. As any sane person should, I release the class when I am done with it, as follows:
[atlasSpriteManager removeChild:deadInsect cleanup:YES];
[deadInsect release];
However, for reasons unknown, this -occasionally- causes a crash. The crash only says EXC_BAD_ACCESS, but the call stack shows me that it was an NSInvocation failing from a Timer fire. I've done my homework and I am not releasing objects with retain counts of 0; they have retain counts of 1, and are then destroyed. If I do not call release there, the crash never happens, but the objects dealloc is never called, implying that they are still ghosting around in memory somewhere.
Based on what I can guess, it appears as though the insect still has some event being called on it. To my understanding, removeChild ends all actions and unschedules all timers?
I suppose what I'm asking is, has anyone encountered this problem before, and if so, do they have any advice for how to solve? I will of course continue to investigate while I await a response, and if I find a solution, I will post it in the hopes it helps someone in the future if they have a similar problem.
OH, and a note, the object is being created via an init, not a convenience function, so it initially has a retain count of 1, and the final release is necessary.