From 69b4b9e81b05cfd842e8096b17c29efdfd1b235b Mon Sep 17 00:00:00 2001 From: Zorg Date: Tue, 12 Jul 2016 20:43:53 -0400 Subject: [PATCH] Fix installer progress app not terminating properly This is done by canceling apple termination events, and by exit'ing later --- .../InstallerProgressAppController.m | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Sparkle/InstallerProgress/InstallerProgressAppController.m b/Sparkle/InstallerProgress/InstallerProgressAppController.m index db6a4e7e..5ee37200 100644 --- a/Sparkle/InstallerProgress/InstallerProgressAppController.m +++ b/Sparkle/InstallerProgress/InstallerProgressAppController.m @@ -95,15 +95,14 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; // the updated application when relaunched will be the frontmost application // This is related to macOS activation issues when terminating a frontmost application happens right before // launching another app -- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)__unused sender { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUTerminationTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [sender replyToApplicationShouldTerminate:YES]; + // Exit right away, don't go through the apple event process again + exit(EXIT_SUCCESS); }); - - [self.delegate applicationWillTerminateAfterDelay]; - - return NSTerminateLater; + // Reply with a 'cancel' rather than 'later' because 'later' may make the runloop stop completely, not having the dispatch_after above invoked + return NSTerminateCancel; } @end