From 49bd7f5160135ec798aaad0b5944bb500e01728c Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Thu, 3 May 2012 13:55:10 +0000 Subject: Remove KVO observers when closing the main window. --- Source/SPConnectionController.m | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'Source/SPConnectionController.m') diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 7e3e793b..df64b738 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -1457,9 +1457,29 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - - [keychain release]; - [prefs release]; + + // Unregister observers + [self removeObserver:self forKeyPath:SPFavoriteNameKey]; + [self removeObserver:self forKeyPath:SPFavoriteHostKey]; + [self removeObserver:self forKeyPath:SPFavoriteUserKey]; + [self removeObserver:self forKeyPath:SPFavoriteDatabaseKey]; + [self removeObserver:self forKeyPath:SPFavoriteSocketKey]; + [self removeObserver:self forKeyPath:SPFavoritePortKey]; + [self removeObserver:self forKeyPath:SPFavoriteUseSSLKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSHHostKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSHUserKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSHPortKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSHKeyLocationEnabledKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSHKeyLocationKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSLKeyFileLocationEnabledKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSLKeyFileLocationKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSLCertificateFileLocationEnabledKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSLCertificateFileLocationKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSLCACertFileLocationEnabledKey]; + [self removeObserver:self forKeyPath:SPFavoriteSSLCACertFileLocationKey]; + + [keychain release]; + [prefs release]; [folderImage release], folderImage = nil; @@ -1478,7 +1498,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, if (currentFavorite) [currentFavorite release], currentFavorite = nil; - [super dealloc]; + [super dealloc]; } @end -- cgit v1.2.3