开发者

Scheduled timer crash after popScene

I seem to be getting a crash right after doing [[CCDirector sharedDirector] popScene]. I am not really sure why. Any clues would help, thanks!

Crashlog:

#0  0x99e5ef84 in objc_msgSend ()
#1  0x302d543a in __NSFastEnumerationMutationHandler ()
#2  0x00046b46 in -[CCScheduler tick:] (self=0x1919ac0, _cmd=0x7b682, d开发者_StackOverflow社区t=0.0333320014) at /Users/Sup3rpanda/Dev/My Projects/Puzzle/libs/cocos2d/CCScheduler.m:211
#3  0x0001fb52 in -[CCDirector mainLoop] (self=0xf10a30, _cmd=0x76272) at /Users/Sup3rpanda/Dev/My Projects/Puzzle/libs/cocos2d/CCDirector.m:208
#4  0x305355cd in __NSFireTimer ()
#5  0x302454a0 in CFRunLoopRunSpecific ()
#6  0x30244628 in CFRunLoopRunInMode ()
#7  0x32044c31 in GSEventRunModal ()
#8  0x32044cf6 in GSEventRun ()
#9  0x309021ee in UIApplicationMain ()
#10 0x00002e94 in main (argc=1, argv=0xbfffef60) at /Users/Sup3rpanda/Dev/My Projects/Puzzle/main.m:13

Scheduled timer:

tGridTimer = [[CCTimer alloc] initWithTarget: self selector: @selector(gridSlideUpForced2:) interval: sGridSpeed];
[[CCScheduler sharedScheduler] scheduleTimer:tGridTimer];

Bit of CoCos 2d code that appears to be related to crashing:

-(void) tick: (ccTime) dt
{
    if( timeScale_ != 1.0f )
        dt *= timeScale_;

    for( id k in methodsToRemove )
        [scheduledMethods removeObject:k];

    [methodsToRemove removeAllObjects];

    for( id k in methodsToAdd )
        [scheduledMethods addObject:k];
    [methodsToAdd removeAllObjects];

    for( CCTimer *t in scheduledMethods )
        impMethod(t, fireSelector, dt);
        [[CCScheduler sharedScheduler] scheduleTimer:tGridTimer];


Are you cleaning up your timers in onExit or dealloc in your scene class? Could be the scene still thinks some of the schedulers are still running

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜