aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-03-10 02:27:21 +0000
committerrowanbeentje <rowan@beent.je>2010-03-10 02:27:21 +0000
commitb5e1e22acd6ac35507b66bd944b33d68eb3f368a (patch)
tree9aaf544f764e4133c8645af6b78e2ef40dc1838e
parent59167274d90d722ee97c2c333f57b8af5b7a7b39 (diff)
downloadsequelpro-b5e1e22acd6ac35507b66bd944b33d68eb3f368a.tar.gz
sequelpro-b5e1e22acd6ac35507b66bd944b33d68eb3f368a.tar.bz2
sequelpro-b5e1e22acd6ac35507b66bd944b33d68eb3f368a.zip
- Ensure endTask is called on the main thread, fixing various thread-safety issues including http://log.sequelpro.com/view/40 and http://log.sequelpro.com/view/21
-rw-r--r--Source/TableDocument.m6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 8e7ba817..2ce0ef9e 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1398,6 +1398,12 @@
- (void) endTask
{
+ // Ensure a call on the main thread
+ if (![NSThread isMainThread]) {
+ [self performSelectorOnMainThread:@selector(endTask) withObject:nil waitUntilDone:YES];
+ return;
+ }
+
// Decrement the working level
_isWorkingLevel--;