aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
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