From f46ea8738082e53d2b86cf6c787f44cd1f1a9539 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 22 Aug 2022 18:23:23 -0700 Subject: [PATCH] Ensure install handlers are invoked on main queue (#2235) --- Sparkle/SPUAutomaticUpdateDriver.m | 4 +++- Sparkle/SPUUIBasedUpdateDriver.m | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Sparkle/SPUAutomaticUpdateDriver.m b/Sparkle/SPUAutomaticUpdateDriver.m index 0c303e05..d3f1e8d8 100644 --- a/Sparkle/SPUAutomaticUpdateDriver.m +++ b/Sparkle/SPUAutomaticUpdateDriver.m @@ -110,7 +110,9 @@ if (self.willInstallSilently && [updaterDelegate respondsToSelector:@selector(updater:willInstallUpdateOnQuit:immediateInstallationBlock:)]) { __weak SPUAutomaticUpdateDriver *weakSelf = self; installationHandledByDelegate = [updaterDelegate updater:self.updater willInstallUpdateOnQuit:self.updateItem immediateInstallationBlock:^{ - [weakSelf.coreDriver finishInstallationWithResponse:SPUUserUpdateChoiceInstall displayingUserInterface:NO]; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf.coreDriver finishInstallationWithResponse:SPUUserUpdateChoiceInstall displayingUserInterface:NO]; + }); }]; } diff --git a/Sparkle/SPUUIBasedUpdateDriver.m b/Sparkle/SPUUIBasedUpdateDriver.m index 174cf6ed..b58f2ba3 100644 --- a/Sparkle/SPUUIBasedUpdateDriver.m +++ b/Sparkle/SPUUIBasedUpdateDriver.m @@ -321,8 +321,9 @@ __weak __typeof__(self) weakSelf = self; [self.userDriver showInstallingUpdateWithApplicationTerminated:applicationTerminated retryTerminatingApplication:^{ if (!applicationTerminated) { - __typeof__(self) strongSelf = weakSelf; - [strongSelf.coreDriver finishInstallationWithResponse:SPUUserUpdateChoiceInstall displayingUserInterface:YES]; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf.coreDriver finishInstallationWithResponse:SPUUserUpdateChoiceInstall displayingUserInterface:YES]; + }); } }]; } else if ([self.userDriver respondsToSelector:@selector(showInstallingUpdateWithApplicationTerminated:)]) {