Skip to content

Commit b535055

Browse files
committed
Fixed [CCScheduler timersForTarget:] to not include invalidated timers.
Former-commit-id: b442d66
1 parent 0d1d86d commit b535055

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cocos2d-ui-tests/tests/CCSchedulerTest.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ -(void)onEnter
4141
[super onEnter];
4242

4343
[self schedule:@selector(after:) interval:2.0];
44+
45+
// Unschedule it and reschedule it to check for rescheduling issues.
46+
[self unschedule:@selector(after:)];
47+
[self schedule:@selector(after:) interval:1.0];
4448
}
4549

4650
-(void)update:(CCTime)delta

cocos2d/CCScheduler.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ -(NSArray *)timersForTarget:(NSObject<CCSchedulerTarget> *)target
504504

505505
NSMutableArray *arr = [NSMutableArray array];
506506
for(CCTimer *timer = scheduledTarget.timers; timer; timer = timer.next){
507-
[arr addObject:timer];
507+
if(!timer.invalid) [arr addObject:timer];
508508
}
509509

510510
return arr;

0 commit comments

Comments
 (0)