From 7a1f627c79bd55c0d792c3d548730eec7681128f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= Date: Sat, 26 Jul 2014 02:16:42 +0100 Subject: [PATCH] Close windows before termination, not after --- Sparkle/SUBasicUpdateDriver.h | 1 + Sparkle/SUBasicUpdateDriver.m | 4 ++++ Sparkle/SUUIBasedUpdateDriver.m | 9 ++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Sparkle/SUBasicUpdateDriver.h b/Sparkle/SUBasicUpdateDriver.h index 341be385..ddd434cb 100644 --- a/Sparkle/SUBasicUpdateDriver.h +++ b/Sparkle/SUBasicUpdateDriver.h @@ -48,6 +48,7 @@ - (void)abortUpdate; - (void)abortUpdateWithError:(NSError *)error; +- (void)terminateApp; @end diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 5a323868..a25b1286 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -378,7 +378,11 @@ self.tempDir, relaunch ? @"1" : @"0", showUI ? @"1" : @"0"]]; + [self terminateApp]; +} +- (void)terminateApp +{ [NSApp terminate:self]; } diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index f9aa8925..73237322 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -186,18 +186,21 @@ [self.statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil]; [self.statusController setButtonEnabled:NO]; [super installWithToolAndRelaunch:relaunch]; +} - +- (void)terminateApp +{ // if a user chooses to NOT relaunch the app (as is the case with WebKit // when it asks you if you are sure you want to close the app with multiple // tabs open), the status window still stays on the screen and obscures // other windows; with this fix, it doesn't - if (self.statusController) - { + if (self.statusController) { [self.statusController close]; self.statusController = nil; } + + [super terminateApp]; } - (void)abortUpdateWithError:(NSError *)error