From b5fc2be113eed4e8c94886604527ad80b2a8f24a Mon Sep 17 00:00:00 2001 From: Chris Campbell Date: Wed, 14 Jan 2015 11:42:33 -0500 Subject: [PATCH] Fix Autoupdate.app crash on 10.7 (issue #441) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Autoupdate.app can crash in the middle of installing an update, leaving the user with a broken application. The crash is caused by the status window’s controller (SUStatusController) being prematurely deallocated before the window is closed. This change prevents such a crash by keeping a strong reference to the SUStatusController in TerminationListener. --- Sparkle/Autoupdate/Autoupdate.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sparkle/Autoupdate/Autoupdate.m b/Sparkle/Autoupdate/Autoupdate.m index b2a651ba..65762d88 100644 --- a/Sparkle/Autoupdate/Autoupdate.m +++ b/Sparkle/Autoupdate/Autoupdate.m @@ -32,6 +32,7 @@ static const NSTimeInterval SUParentQuitCheckInterval = .25; @property (strong) SUHost *host; @property (assign) BOOL shouldRelaunch; @property (assign) BOOL shouldShowUI; +@property (strong) SUStatusController *statusController; - (void)parentHasQuit; @@ -86,6 +87,7 @@ static const NSTimeInterval SUParentQuitCheckInterval = .25; - (void)dealloc { [self.longInstallationTimer invalidate]; + [self.statusController close]; } @@ -152,7 +154,10 @@ static const NSTimeInterval SUParentQuitCheckInterval = .25; [statusCtl beginActionWithTitle:SULocalizedString(@"Installing update...", @"") maxProgressValue: 0 statusText: @""]; [statusCtl showWindow:self]; - } + + [self.statusController close]; // If there's an existing status controller, close it before we release our strong reference to it. + self.statusController = statusCtl; // Keep a strong reference to the status controller, or else it might get prematurely deallocated. +} [SUInstaller installFromUpdateFolder:self.folderpath overHost:self.host