Revision: 14019
http://sourceforge.net/p/skim-app/code/14019
Author: hofman
Date: 2024-01-26 10:12:18 +0000 (Fri, 26 Jan 2024)
Log Message:
-----------
use block based timer with weak target
Modified Paths:
--------------
trunk/SKSyncDot.m
Modified: trunk/SKSyncDot.m
===================================================================
--- trunk/SKSyncDot.m 2024-01-26 00:28:55 UTC (rev 14018)
+++ trunk/SKSyncDot.m 2024-01-26 10:12:18 UTC (rev 14019)
@@ -42,7 +42,7 @@
@interface SKSyncDot (SKPrivate)
-- (void)finish:(NSTimer *)aTimer;
+- (void)finish;
- (void)animate;
@end
@@ -59,7 +59,7 @@
page = aPage;
phase = 0;
__weak SKSyncDot *weakSelf = self;
- timer = [NSTimer scheduledTimerWithTimeInterval:0.05 repeats:YES
block:^(NSTimer *timer){ [weakSelf animate]; }];
+ timer = [NSTimer scheduledTimerWithTimeInterval:0.05 repeats:YES
block:^(NSTimer *t){ [weakSelf animate]; }];
handler = [aHandler copy];
}
return self;
@@ -69,7 +69,7 @@
[timer invalidate];
}
-- (void)finish:(NSTimer *)aTimer {
+- (void)finish {
[timer invalidate];
timer = nil;
if (handler) {
@@ -81,7 +81,8 @@
- (void)animate {
if (atomic_fetch_add(&phase, 1) >= 9) {
[timer invalidate];
- timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self
selector:@selector(finish:) userInfo:NULL repeats:NO];
+ __weak SKSyncDot *weakSelf = self;
+ timer = [NSTimer scheduledTimerWithTimeInterval:5.0 repeats:NO
block:^(NSTimer *t){ [weakSelf finish]; }];
}
if (handler) handler(NO);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit