From 3ad23bdcba482363a0d778c3f8a9e9795d9e76a5 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 12 Jul 2021 00:05:14 -0700 Subject: [PATCH] Call SUUpdater updaterDidRelaunchApplication: on delegate (1.x stub) --- Sparkle/SUUpdater.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index 63200aa3..0b582b17 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -86,6 +86,13 @@ static NSMutableDictionary *sharedUpdaters = nil; NSError *updaterError = nil; if (![self.updater startUpdater:&updaterError]) { SULog(SULogLevelError, @"Error: Failed to start updater with error: %@", updaterError); + } else if ([bundle isEqual:NSBundle.mainBundle] && SPUUpdater.mainBundleRelaunchedFromUpdate) { + // Give another runloop cycle's chance for delegate to be set + dispatch_async(dispatch_get_main_queue(), ^{ + if ([self.delegate respondsToSelector:@selector(updaterDidRelaunchApplication:)]) { + [self.delegate updaterDidRelaunchApplication:self]; + } + }); } } return self;