diff options
Diffstat (limited to 'Source/SPSSHTunnel.m')
-rw-r--r-- | Source/SPSSHTunnel.m | 9 |
1 files changed, 7 insertions, 2 deletions
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]; |