aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-10-14 19:22:45 +0000
committerrowanbeentje <rowan@beent.je>2012-10-14 19:22:45 +0000
commitd8896ae0a22b0014d0b43706280c8a390f14b058 (patch)
tree7ffd10862c22a37507bd7d10edae26d015fd5620 /Source
parentdc45c654aab99cbccecda192396dc8baefd5690e (diff)
downloadsequelpro-d8896ae0a22b0014d0b43706280c8a390f14b058.tar.gz
sequelpro-d8896ae0a22b0014d0b43706280c8a390f14b058.tar.bz2
sequelpro-d8896ae0a22b0014d0b43706280c8a390f14b058.zip
- Clean up some connection cancellation/close-during-connect edges as a result of r3894, attempting to improve some exceptions during aborted connections
- Name threads created in SPMySQL.framework
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConnectionController.m5
-rw-r--r--Source/SPConnectionHandler.m6
-rw-r--r--Source/SPDatabaseDocument.m6
3 files changed, 10 insertions, 7 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 23fe0911..2e619285 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -302,10 +302,6 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2,
[progressIndicatorText setStringValue:NSLocalizedString(@"Cancelling...", @"cancelling task status message")];
[progressIndicatorText display];
-
- if (mySQLConnection) {
- [NSThread detachNewThreadSelector:@selector(disconnect) toTarget:mySQLConnection withObject:nil];
- }
#endif
cancellingConnection = YES;
@@ -1789,6 +1785,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2,
- (void)_documentWillClose:(NSNotification *)notification
{
+ cancellingConnection = YES;
dbDocument = nil;
if (mySQLConnection) {
[mySQLConnection setDelegate:nil];
diff --git a/Source/SPConnectionHandler.m b/Source/SPConnectionHandler.m
index 3495eb95..6efdf366 100644
--- a/Source/SPConnectionHandler.m
+++ b/Source/SPConnectionHandler.m
@@ -291,8 +291,10 @@ static NSString *SPLocalhostAddress = @"127.0.0.1";
isConnecting = NO;
// If the user is only testing the connection, kill the connection
- // once established and reset the UI.
- if (isTestingConnection) {
+ // once established and reset the UI. Also catch connection cancels.
+ if (isTestingConnection || cancellingConnection) {
+
+ // Clean up any connections remaining, and reset the UI
[self cancelConnection:self];
if (isTestingConnection) {
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index fa46db2d..7f2abab6 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -415,6 +415,10 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase";
- (void)setConnection:(SPMySQLConnection *)theConnection
{
+ if ([theConnection userTriggeredDisconnect]) {
+ return;
+ }
+
_isConnected = YES;
mySQLConnection = [theConnection retain];
@@ -5762,7 +5766,7 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase";
if (processListController) [processListController release];
if (serverVariablesController) [serverVariablesController release];
#endif
- if (mySQLConnection) [mySQLConnection release];
+ if (mySQLConnection) [mySQLConnection release], mySQLConnection = nil;
if (selectedDatabase) [selectedDatabase release];
if (mySQLVersion) [mySQLVersion release];
#ifndef SP_REFACTOR