From 1f0dde0452519496a3d361ad6ddb38731c350a7e Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 27 May 2012 22:33:26 +0000 Subject: Improve connection handling and editing: - Fix long-standing intermittent crashes caused by connection errors after SSH tunnels were established - Fix edits causing keychain -25299 errors (Issue #1340) - Allow changes of favourite type to be saved rather than disassociating the edit from the selection - Fix the favourites view scrolling to the top when there's no selection and connection details are being edited - Fix some issues with automatic naming of connections on connection type change --- Source/SPSSHTunnel.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Source/SPSSHTunnel.m') diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m index 106f8774..083a1000 100644 --- a/Source/SPSSHTunnel.m +++ b/Source/SPSSHTunnel.m @@ -390,11 +390,15 @@ { if (connectionState == SPMySQLProxyIdle) return; + // If there's a delegate set, clear it to prevent unexpected state change messaging + if (delegate) { + delegate = nil; + stateChangeSelector = NULL; + } + // Before terminating the tunnel, check that it's actually running. This is to accommodate tunnels which // suddenly disappear as a result of network disconnections. if ([task isRunning]) [task terminate]; - - if (delegate) [delegate performSelectorOnMainThread:stateChangeSelector withObject:self waitUntilDone:NO]; } /* @@ -663,6 +667,7 @@ delegate = nil; [[NSNotificationCenter defaultCenter] removeObserver:self]; if (connectionState != SPMySQLProxyIdle) [self disconnect]; + [NSObject cancelPreviousPerformRequestsWithTarget:self]; [sshHost release]; [sshLogin release]; [remoteHost release]; -- cgit v1.2.3