aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2016-06-26 04:15:33 +0200
committerMax <post@wickenrode.com>2016-06-26 04:15:33 +0200
commitbfc53dc39c04f4c2eb3d0d79a938cf5dea368da5 (patch)
tree7151780184012638bf8ea33df9abae0565d58527
parentbede490a2595a2f7495e8b757c02314f8ded4bcf (diff)
downloadsequelpro-bfc53dc39c04f4c2eb3d0d79a938cf5dea368da5.tar.gz
sequelpro-bfc53dc39c04f4c2eb3d0d79a938cf5dea368da5.tar.bz2
sequelpro-bfc53dc39c04f4c2eb3d0d79a938cf5dea368da5.zip
Fix a case of "background thread updating UI"
-rw-r--r--Source/SPDatabaseDocument.m34
1 files changed, 18 insertions, 16 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 2931ba9f..51fc7a7e 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -6303,22 +6303,24 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
#ifndef SP_CODA /* update selected table in SPTablesList */
- BOOL focusOnFilter = YES;
- if (targetItemName) focusOnFilter = NO;
-
- // If a the table has changed, update the selection
- if (![targetItemName isEqualToString:[self table]] && targetItemName) {
- focusOnFilter = ![tablesListInstance selectItemWithName:targetItemName];
- }
-
- // Ensure the window focus is on the table list or the filter as appropriate
- [[tablesListInstance onMainThread] setTableListSelectability:YES];
- if (focusOnFilter) {
- [[tablesListInstance onMainThread] makeTableListFilterHaveFocus];
- } else {
- [[tablesListInstance onMainThread] makeTableListHaveFocus];
- }
- [[tablesListInstance onMainThread] setTableListSelectability:NO];
+ SPMainQSync(^{
+ BOOL focusOnFilter = YES;
+ if (targetItemName) focusOnFilter = NO;
+
+ // If a the table has changed, update the selection
+ if (![targetItemName isEqualToString:[self table]] && targetItemName) {
+ focusOnFilter = ![tablesListInstance selectItemWithName:targetItemName];
+ }
+
+ // Ensure the window focus is on the table list or the filter as appropriate
+ [tablesListInstance setTableListSelectability:YES];
+ if (focusOnFilter) {
+ [tablesListInstance makeTableListFilterHaveFocus];
+ } else {
+ [tablesListInstance makeTableListHaveFocus];
+ }
+ [tablesListInstance setTableListSelectability:NO];
+ });
#endif
[self endTask];