Hey guys, ive got a very peculiar bug appear today.
I've been working on my project a long time now, and i must have added something today to cause this..
Basically, i have a CCScene called GameScene
GameScene has 2 children, HUDLayer and GameLayer
The problem is, GameLayer is not deallocating. I have an NSLog in [GameLayer dealloc], the method never gets called. It means that when you loose, if you go back into the level, it crashes because it says you can't add the same child twice.
Very very rarely, it does deallocate.
What would stop a Layer from deallocating, perhaps I have a retained child of that layer somewhere?
My Control layer's dealloc method
- (void) dealloc
{
// in case you have something to dealloc, do it in this method
// in this particular example nothing needs to be released.
// don't forget to call "super dealloc"
NSLog(@"control layer dealloc called");
[_mapsheet removeAllChildrenWithCleanup:YES];
[self removeChild:_mapsheet cleanup:YES];
_mapsheet = nil;
[_mapsheetNonAlpha removeAllChildrenWithCleanup:YES];
[self removeChild:_mapsheetNonAlpha cleanup:YES];
_mapsheetNonAlpha = nil;
cpSpaceFreeChildren(_gameSpace);
cpSpaceFree(_gameSpace);
_gameSpace = nil;
NSLog(@"gamespace purged???");
[_movingSprites release];
_movingSprites = nil;
[self removeAllChildrenWithCleanup:YES];
[super dealloc];
}
This does not get called though..