Fix installer progress app not terminating properly

This is done by canceling apple termination events, and by exit'ing later
This commit is contained in:
Zorg committed 2016-07-12 20:43:53 -04:00
1 parent 8563a40cd2
commit 69b4b9e81b
1 file changed
+5 -6
+5 -6
View File
@@ -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