aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CustomQuery.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-03-08 00:20:24 +0000
committerrowanbeentje <rowan@beent.je>2010-03-08 00:20:24 +0000
commitd638ce370f202cb9d8338eeb3f981d9f70f548ff (patch)
tree98158d357adb872e73346e72a1bb6658da7dd70b /Source/CustomQuery.m
parent4c46e5ed3e78002f7f3c791c545f63556d6c8028 (diff)
downloadsequelpro-d638ce370f202cb9d8338eeb3f981d9f70f548ff.tar.gz
sequelpro-d638ce370f202cb9d8338eeb3f981d9f70f548ff.tar.bz2
sequelpro-d638ce370f202cb9d8338eeb3f981d9f70f548ff.zip
- Move history popup construction to the main thread, fixing crashes probably caused by non-thread-safe menu interaction. This addresses http://log.sequelpro.com/view/19
Diffstat (limited to 'Source/CustomQuery.m')
-rw-r--r--Source/CustomQuery.m13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 2992d373..2e26f08e 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -713,8 +713,7 @@
// add query to history
if(!reloadingExistingResult && [usedQuery length])
- [[SPQueryController sharedQueryController] addHistory:usedQuery forFileURL:[tableDocumentInstance fileURL]];
-
+ [self performSelectorOnMainThread:@selector(addHistoryEntry:) withObject:usedQuery waitUntilDone:NO];
// Error checking
if ( [mySQLConnection queryCancelled] || ([errors length] && !queryIsTableSorter)) {
@@ -2886,6 +2885,16 @@
{
return [[[SPQueryController sharedQueryController] historyForFileURL:[tableDocumentInstance fileURL]] componentsJoinedByString:@";\n"];
}
+
+/**
+ * Add a query string to the file/global history, via the query controller.
+ * Single argument allows calls on the main thread.
+ */
+- (void)addHistoryEntry:(NSString *)entryString
+{
+ [[SPQueryController sharedQueryController] addHistory:entryString forFileURL:[tableDocumentInstance fileURL]];
+}
+
/*
* This method is called as part of Key Value Observing which is used to watch for prefernce changes which effect the interface.
*/