diff options
author | Max <post@wickenrode.com> | 2015-10-13 14:57:00 +0200 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-10-13 14:57:00 +0200 |
commit | 27763d429365c0127198f2e9abdd488a61c9f41e (patch) | |
tree | f6533c479830f6dc42218261414f52df5d87317a | |
parent | 63b23073b99097f03a57eb8f0e11a906cc4313d6 (diff) | |
download | sequelpro-27763d429365c0127198f2e9abdd488a61c9f41e.tar.gz sequelpro-27763d429365c0127198f2e9abdd488a61c9f41e.tar.bz2 sequelpro-27763d429365c0127198f2e9abdd488a61c9f41e.zip |
Fix another case of "background thread updating UI"
-rw-r--r-- | Source/SPDatabaseDocument.m | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 57ecdd97..66a56ea7 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -110,6 +110,7 @@ enum { #import "SPCharsetCollationHelper.h" #import "SPGotoDatabaseController.h" +#import "SPFunctions.h" #import <SPMySQL/SPMySQL.h> @@ -4818,7 +4819,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; // If the .spf format is unhandled, error. if (![[spf objectForKey:SPFFormatKey] isEqualToString:@"connection"]) { - NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Warning", @"warning")] + NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Unknown file format", @"warning")] defaultButton:NSLocalizedString(@"OK", @"OK button") alternateButton:nil otherButton:nil @@ -5038,21 +5039,24 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; } - // Select view - if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_STRUCTURE"]) - [self viewStructure:self]; - else if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_CONTENT"]) - [self viewContent:self]; - else if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_CUSTOMQUERY"]) - [self viewQuery:self]; - else if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_STATUS"]) - [self viewStatus:self]; - else if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_RELATIONS"]) - [self viewRelations:self]; - else if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_TRIGGERS"]) - [self viewTriggers:self]; - - [self updateWindowTitle:self]; + // update UI on main thread + SPMainQSync(^{ + // Select view + if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_STRUCTURE"]) + [self viewStructure:self]; + else if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_CONTENT"]) + [self viewContent:self]; + else if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_CUSTOMQUERY"]) + [self viewQuery:self]; + else if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_STATUS"]) + [self viewStatus:self]; + else if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_RELATIONS"]) + [self viewRelations:self]; + else if([[spfSession objectForKey:@"view"] isEqualToString:@"SP_VIEW_TRIGGERS"]) + [self viewTriggers:self]; + + [self updateWindowTitle:self]; + }); // dealloc spfSession data SPClear(spfSession); |