From 9052ea912d7902ca7162d489a8e69146a6baa8e7 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 11 Apr 2021 14:43:34 -0700 Subject: [PATCH] Ensure permission request response is handled on main thread We were doing this before but I accidentally removed it in a recent commit. --- Sparkle/SPUUpdater.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Sparkle/SPUUpdater.m b/Sparkle/SPUUpdater.m index c4fe937c..2971837e 100644 --- a/Sparkle/SPUUpdater.m +++ b/Sparkle/SPUUpdater.m @@ -310,12 +310,14 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification __weak SPUUpdater *weakSelf = self; [self.userDriver showUpdatePermissionRequest:updatePermissionRequest reply:^(SUUpdatePermissionResponse *response) { - SPUUpdater *strongSelf = weakSelf; - if (strongSelf != nil) { - [strongSelf updatePermissionRequestFinishedWithResponse:response]; - // Schedule checks, but make sure we ignore the delayed call from KVO - [strongSelf resetUpdateCycle]; - } + dispatch_async(dispatch_get_main_queue(), ^{ + SPUUpdater *strongSelf = weakSelf; + if (strongSelf != nil) { + [strongSelf updatePermissionRequestFinishedWithResponse:response]; + // Schedule checks, but make sure we ignore the delayed call from KVO + [strongSelf resetUpdateCycle]; + } + }); }]; // We start the update checks and register as observer for changes after the prompt finishes