I have a Cocos2d scene (CCLayer) with a CCMenu. I implement the dealloc as
- (void) dealloc {
[menu release];
menu = nil;
[super dealloc];
}
when i use shared director to replace the scene with an other, it load the second scene and then program crash in dealloc, especially in
[super dealloc]; //Thread1: Program received signal: "EXC_BAD_ACCESS".
The call to replace the scene is
[[CCDirector sharedDirector] replaceScene:
[CCTransitionFade transitionWithDuration:0.5f scene:[SomeOtherScene scene]]];
Why is this happens? Should i call [super dealloc] or not?
I think you need to set menu to nil THEN release it, that may be your issue. And to answer your second question yes you definitely should call [super dealloc] or it could cause more issues.