From 079f1e33bc9f1c0c7530c76d278709ffe32f1e22 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 12 Mar 2016 18:26:54 -0500 Subject: [PATCH] Guard against more than 1 initialization more strongly --- Sparkle/SUStandardUpdaterController.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Sparkle/SUStandardUpdaterController.m b/Sparkle/SUStandardUpdaterController.m index b5464008..f8c73c7a 100644 --- a/Sparkle/SUStandardUpdaterController.m +++ b/Sparkle/SUStandardUpdaterController.m @@ -20,7 +20,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults @property (nonatomic) SUUpdater *updater; @property (nonatomic) id userDriver; -@property (nonatomic) BOOL awokeFromNib; +@property (nonatomic) BOOL initializedUpdater; @end @@ -30,7 +30,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults @synthesize userDriver = _userDriver; @synthesize updaterDelegate = _updaterDelegate; @synthesize userDriverDelegate = _userDriverDelegate; -@synthesize awokeFromNib = _awokeFromNib; +@synthesize initializedUpdater = _initializedUpdater; - (instancetype)initWithUpdater:(SUUpdater *)updater userDriver:(id)userDriver { @@ -38,6 +38,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults if (self != nil) { self.updater = updater; self.userDriver = userDriver; + self.initializedUpdater = YES; } return self; } @@ -57,9 +58,9 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults { // awakeFromNib might be called more than once; guard against that // We have to use awakeFromNib otherwise the delegate outlets may not be connected yet, - // and we aren't a proper window or view controller or anything like that - if (!self.awokeFromNib) { - self.awokeFromNib = YES; + // and we aren't a proper window or view controller, so we don't have a proper "did load" point + if (!self.initializedUpdater) { + self.initializedUpdater = YES; // We may not be living in the same bundle as the main bundle so we can't use that // We also can't self [self class] because somebody could subclass us and could live elsewhere