aboutsummaryrefslogtreecommitdiffstats
path: root/Source
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
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')
-rw-r--r--Source/CustomQuery.h1
-rw-r--r--Source/CustomQuery.m13
2 files changed, 12 insertions, 2 deletions
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index e73f70da..526010ad 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -225,6 +225,7 @@
- (NSUInteger)numberOfQueries;
- (NSString *)buildHistoryString;
+- (void)addHistoryEntry:(NSString *)entryString;
- (void)historyItemsHaveBeenUpdated:(id)manager;
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.
*/