Fix potential hang with dispatch_sync to main thread

This commit is contained in:
Brian Bergstrand committed 2018-05-25 14:32:57 -05:00
1 parent a18282ec79
commit 1c4bcda012
1 file changed
+8 -2
+8 -2
View File
@@ -241,11 +241,17 @@
- (void)extractUpdate
{
dispatch_sync(dispatch_get_main_queue(), ^{
dispatch_block_t updateUI = ^{
// Now we have to extract the downloaded archive.
[self.statusController beginActionWithTitle:SULocalizedString(@"Extracting update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
[self.statusController setButtonEnabled:NO];
});
};
if (![NSThread mainThread]) {
dispatch_sync(dispatch_get_main_queue(), updateUI);
} else {
updateUI();
}
[super extractUpdate];
}