Avoid invalid use of main thread

Fixes #1189
This commit is contained in:
Kornel committed 2018-03-18 13:41:08 +00:00
1 parent 2a0514c93b
commit 57731f44d7
1 file changed
+7 -2
+7 -2
View File
@@ -304,7 +304,7 @@
- (void)abortUpdateWithError:(NSError *)error
{
dispatch_sync(dispatch_get_main_queue(), ^{
void (^callback)() = ^{
if (self.showErrors) {
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = SULocalizedString(@"Update Error!", nil);
@@ -313,7 +313,12 @@
[self showAlert:alert];
}
[super abortUpdateWithError:error];
});
};
if ([NSThread isMainThread]) {
callback();
} else {
dispatch_sync(dispatch_get_main_queue(), callback);
}
}
- (void)abortUpdate