aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-06-01 00:10:02 +0000
committerrowanbeentje <rowan@beent.je>2010-06-01 00:10:02 +0000
commita2d64457e1c52d2d72863407537e950c80595231 (patch)
treeef59124222e77a56bcf88ce446626bd6aa6e8eed /Source
parentf5e5d40e5e9569470e52cbaaba4d4352dc2a71d7 (diff)
downloadsequelpro-a2d64457e1c52d2d72863407537e950c80595231.tar.gz
sequelpro-a2d64457e1c52d2d72863407537e950c80595231.tar.bz2
sequelpro-a2d64457e1c52d2d72863407537e950c80595231.zip
- Ensure start/end query notifications are sent on the main thread to avoid the interface being updated from the wrong thread on listeners
- Add a "Support Files" folder to MCPKit, containing NSNotificationAdditions to support main thread notifications from within MCPKit
Diffstat (limited to 'Source')
-rw-r--r--Source/CustomQuery.m6
-rw-r--r--Source/SPDatabaseDocument.m4
-rw-r--r--Source/SPTableContent.m14
-rw-r--r--Source/SPTableStructure.m8
-rw-r--r--Source/SPTablesList.m4
5 files changed, 18 insertions, 18 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 3585eb16..b5ba5306 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -503,7 +503,7 @@
[tableDocumentInstance setQueryMode:SPCustomQueryQueryMode];
// Notify listeners that a query has started
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
// Start the notification timer to allow notifications to be shown even if frontmost for long queries
[[SPGrowlController sharedGrowlController] setVisibilityForNotificationName:@"Query Finished"];
@@ -740,7 +740,7 @@
[customQueryView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES];
// Notify any listeners that the query has completed
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
// Perform the Growl notification for query completion
[[SPGrowlController sharedGrowlController] notifyWithTitle:@"Query Finished"
@@ -794,7 +794,7 @@
[customQueryView setTableInstance:self withTableData:resultData withColumns:cqColumnDefinition withTableName:resultTableName withConnection:mySQLConnection];
//query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
// Query finished Growl notification
[[SPGrowlController sharedGrowlController] notifyWithTitle:@"Query Finished"
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 92f83a79..72cf201b 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -1085,7 +1085,7 @@
NSString *dbName = nil;
// Notify listeners that a query has started
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:self];
MCPResult *theResult = [mySQLConnection queryString:@"SELECT DATABASE()"];
if (![mySQLConnection queryErrored]) {
@@ -1110,7 +1110,7 @@
}
//query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:self];
}
- (BOOL)navigatorSchemaPathExistsForDatabase:(NSString*)dbname
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 79b8910c..a03e17a7 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -198,7 +198,7 @@
}
// Post a notification that a query will be performed
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
// Set up the table details for the new table, and trigger an interface update
NSDictionary *tableDetails = [NSDictionary dictionaryWithObjectsAndKeys:
@@ -234,7 +234,7 @@
// Init copyTable with necessary information for copying selected rows as SQL INSERT
[tableContentView setTableInstance:self withTableData:tableValues withColumns:dataColumns withTableName:selectedTable withConnection:mySQLConnection];
// Post the notification that the query is finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
// Clear any details to restore now that they have been restored
[self clearDetailsToRestore];
@@ -566,7 +566,7 @@
[countText setStringValue:NSLocalizedString(@"Loading table data...", @"Loading table data string")];
// Notify any listeners that a query has started
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
// Start construction of the query string
queryString = [NSMutableString stringWithFormat:@"SELECT %@ FROM %@", [self fieldListForQuery], [selectedTable backtickQuotedString]];
@@ -673,7 +673,7 @@
[self updatePaginationState];
// Notify listenters that the query has finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
// Trigger a full reload if required
if (fullTableReloadRequired) [self reloadTable:self];
@@ -2098,13 +2098,13 @@
return YES;
}
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
// If editing, compare the new row to the old row and if they are identical finish editing without saving.
if (!isEditingNewRow && [oldRow isEqualToArray:[tableValues rowContentsAtIndex:currentlyEditingRow]]) {
isEditingRow = NO;
currentlyEditingRow = -1;
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
return YES;
}
@@ -2204,7 +2204,7 @@
}
[fieldValues release];
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
// If no rows have been changed, show error if appropriate.
if ( ![mySQLConnection affectedRows] && ![mySQLConnection queryErrored] ) {
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index e14e76a1..74cae1c3 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -67,7 +67,7 @@
}
// Send the query started/working notification
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
// Retrieve the column information for this table.
// TODO: update this and indexes to use TableData at some point - tiny bit more parsing required...
@@ -75,7 +75,7 @@
// If an error occurred, reset the interface and abort
if ([mySQLConnection queryErrored]) {
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
[[self onMainThread] setTableDetails:nil];
if ([mySQLConnection isConnected]) {
@@ -97,7 +97,7 @@
// If an error occurred, reset the interface and abort
if ([mySQLConnection queryErrored]) {
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
[[self onMainThread] setTableDetails:nil];
if ([mySQLConnection isConnected]) {
@@ -192,7 +192,7 @@
[[self onMainThread] setTableDetails:tableDetails];
// Send the query finished/work complete notification
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
}
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index 153e0227..498a5166 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -90,7 +90,7 @@
if ([tableDocumentInstance database]) {
// Notify listeners that a query has started
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
// Select the table list for the current database. On MySQL versions after 5 this will include
// views; on MySQL versions >= 5.0.02 select the "full" list to also select the table type column.
@@ -208,7 +208,7 @@
}
*/
// Notify listeners that the query has finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
}
// Add the table headers even if no tables were found