DNESS / cocos2d-iphone

Automatically exported from code.google.com/p/cocos2d-iphone
1 stars 0 forks source link

Releasing sprite after Director ends causes crash on 0.8.2 Simulator 2.2 #621

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
    Scene *scene = [Scene node];
    Sprite *spr = [[Sprite alloc] initWithFile:@"Icon.png"];
    [scene addChild:spr];
    [[Director sharedDirector] runWithScene:scene];
    [[Director sharedDirector] end];
    [spr release];

What is the expected output? What do you see instead?
I expect it not to crash. It follows correct memory management rules (one 
release for one alloc). 
Instead, it crashes.

If the sprite is released prior to the call to [[Director sharedDirector] end], 
then it does not crash. 
But it should not be possible to release something "too late" (only "too early" 
should be a 
problem).

What cocos2d version are you using ?
0.8.2

What iPhoneSDK are you using ?
2.2

Debug or Release ?
Debug

Does this happens on device ? or on the simulator ? or on both ?
simulator (not tested on device; but likely device also)

Please provide any additional information below.

Original issue reported on code.google.com by spoon.re...@gmail.com on 10 Nov 2009 at 6:22

GoogleCodeExporter commented 9 years ago
workaround: release the sprite after it as added as a child.

Original comment by ricardoq...@gmail.com on 10 Nov 2009 at 11:11

GoogleCodeExporter commented 9 years ago
@ricardoquesada: Thanks. But this is a simplified example. In my actual code, 
the
sprite needs to be referenced by one of my objects, so it has to retain the 
sprite.

Original comment by spoon.re...@gmail.com on 10 Nov 2009 at 6:26

GoogleCodeExporter commented 9 years ago
Update: I tested it on one of my devices, and it didn't seem to crash. Can 
anyone
else verify that it doesn't crash on the device?

Original comment by spoon.re...@gmail.com on 16 Nov 2009 at 8:30