diff options
author | rowanbeentje <rowan@beent.je> | 2010-06-01 00:10:02 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-06-01 00:10:02 +0000 |
commit | a2d64457e1c52d2d72863407537e950c80595231 (patch) | |
tree | ef59124222e77a56bcf88ce446626bd6aa6e8eed /Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | |
parent | f5e5d40e5e9569470e52cbaaba4d4352dc2a71d7 (diff) | |
download | sequelpro-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 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m')
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index eca76dcb..f36cff2c 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -35,6 +35,7 @@ #import "MCPStringAdditions.h" #import "SPStringAdditions.h" #import "RegexKitLite.h" +#import "NSNotificationAdditions.h" #include <unistd.h> #include <mach/mach_time.h> @@ -1388,7 +1389,7 @@ void performThreadedKeepAlive(void *ptr) if ([delegate respondsToSelector:@selector(queryGaveError:connection:)]) [delegate queryGaveError:@"No connection available!" connection:self]; // Notify that the query has been performed - [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:delegate]; + [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:delegate]; // Inform the delegate that there is no connection available if (delegate && [delegate respondsToSelector:@selector(noConnectionAvailable:)]) { @@ -1439,7 +1440,7 @@ void performThreadedKeepAlive(void *ptr) [self setLastErrorMessage:errorMessage]; // Notify that the query has been performed - [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:delegate]; + [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:delegate]; // Show an error alert while resetting if ([delegate respondsToSelector:@selector(showErrorWithTitle:message:)]) @@ -1460,7 +1461,7 @@ void performThreadedKeepAlive(void *ptr) if (queryErrorMessage) [queryErrorMessage release], queryErrorMessage = nil; // Notify that the query has been performed - [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:delegate]; + [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:delegate]; return nil; } } |