I feel like I must be missing something, but if I have a sprite manager instance and release it from my layer, it crashes cocos2d.
Here's what I mean, for example
@interface LittlePhysics : Layer
{
AtlasSpriteManager* _spriteManager;
....
}
@property(nonatomic, retain) AtlasSpriteManager* _spriteManager;
Then in the implimentation:
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init] ))
{
...
// Create the texture for the sprite manager
Texture2D* texture = [[TextureMgr sharedTextureMgr] addImage:@"pieces.png"];
[texture setAliasTexParameters];
// Pass in the texture, and create the sprite manager
_spriteManager = [AtlasSpriteManager spriteManagerWithTexture:texture];
[_spriteManager setBlendFunc:(ccBlendFunc) {GL_ONE, GL_ONE_MINUS_SRC_COLOR }];
[self addChild:_spriteManager z:0 tag:0];
...
}
}
- (void) dealloc
{
...
[_spriteManager release];
[super dealloc];
}
If I remove that [_spriteManager release] line, everything is fine. Also if it IS removed, the app runs fine, it doesn't appear to have a memory leak without that line.
I feel like there's something i'm missing.
I'm getting ready to maybe try to submit my little free app (http://littlephysics.com) on monday, and I wanna make sure I cross my T's and dot my I's.