aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseDocument.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-01-31 23:39:19 +0000
committerrowanbeentje <rowan@beent.je>2011-01-31 23:39:19 +0000
commita5adeec3a56b0d1c47ded03187840d92f63b2976 (patch)
treee6a5a8bd231c6bc331a220496a6deb0190f65560 /Source/SPDatabaseDocument.m
parent01f5d5e8bae1d39096c418678e82f59c021c195d (diff)
downloadsequelpro-a5adeec3a56b0d1c47ded03187840d92f63b2976.tar.gz
sequelpro-a5adeec3a56b0d1c47ded03187840d92f63b2976.tar.bz2
sequelpro-a5adeec3a56b0d1c47ded03187840d92f63b2976.zip
- Ensure window title updates occur on the main thread, fixing crashes under race conditions
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r--Source/SPDatabaseDocument.m16
1 files changed, 10 insertions, 6 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 96bfbf39..adff490d 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -835,12 +835,12 @@
if (selectedDatabase) [selectedDatabase release], selectedDatabase = nil;
selectedDatabase = [[NSString alloc] initWithString:dbName];
[chooseDatabaseButton selectItemWithTitle:selectedDatabase];
- [[self onMainThread] updateWindowTitle:self];
+ [self updateWindowTitle:self];
}
} else {
if (selectedDatabase) [selectedDatabase release], selectedDatabase = nil;
[chooseDatabaseButton selectItemAtIndex:0];
- [[self onMainThread] updateWindowTitle:self];
+ [self updateWindowTitle:self];
}
}
@@ -3305,6 +3305,10 @@
*/
- (void) updateWindowTitle:(id)sender
{
+
+ // Ensure a call on the main thread
+ if (![NSThread isMainThread]) return [self updateWindowTitle:sender];
+
NSMutableString *tabTitle;
NSMutableString *windowTitle;
SPDatabaseDocument *frontTableDocument = [parentWindowController selectedTableDocument];
@@ -4543,7 +4547,7 @@
- (void)connectionControllerConnectAttemptFailed:(id)controller
{
// Reset the window title
- [[self onMainThread] updateWindowTitle:self];
+ [self updateWindowTitle:self];
}
#pragma mark -
@@ -5506,7 +5510,7 @@
[tablesListInstance setConnection:mySQLConnection];
[tableDumpInstance setConnection:mySQLConnection];
- [[self onMainThread] updateWindowTitle:self];
+ [self updateWindowTitle:self];
}
/**
@@ -5545,7 +5549,7 @@
[tablesListInstance setConnection:mySQLConnection];
[tableDumpInstance setConnection:mySQLConnection];
- [[self onMainThread] updateWindowTitle:self];
+ [self updateWindowTitle:self];
}
/**
@@ -5602,7 +5606,7 @@
[tableDumpInstance setConnection:mySQLConnection];
// Update the window title
- [[self onMainThread] updateWindowTitle:self];
+ [self updateWindowTitle:self];
// Add a history entry
if (!historyStateChanging) {