mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Added a timer invalidation in a asynchronous callback.
The scheduleNextUpdateCheckFiringImmediately: method includes an asynchronous callback. It invalidates the timer before invoking the method with the callback (retrieveNextUpdateCheckInterval:), but doesn’t not invalidate again inside the callback block. The problem with this is that it is possible the timer is started during the delay. In release versions of an app, crashes have been seen due to an assertion that the NSTimer be nil when scheduling. The proposed fix is to invalidate the timer in the callback, ensuring the NSTimer is nil before scheduling.
This commit is contained in:
1 parent
c3c2e51a08
commit
ab942fa9b7
1 file changed
+3
Vendored
+3
@@ -351,6 +351,9 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
[self.userDriver showCanCheckForUpdates:YES];
|
||||
|
||||
[self retrieveNextUpdateCheckInterval:^(NSTimeInterval updateCheckInterval) {
|
||||
// This callback is asynchronous, so the timer may be set. Invalidate to make sure it isn't.
|
||||
[self.updaterTimer invalidate];
|
||||
|
||||
// How long has it been since last we checked for an update?
|
||||
NSDate *lastCheckDate = [self lastUpdateCheckDate];
|
||||
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
|
||||
|
||||
Reference in new issue
Block a user