aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-05-03 13:55:10 +0000
committerstuconnolly <stuart02@gmail.com>2012-05-03 13:55:10 +0000
commit49bd7f5160135ec798aaad0b5944bb500e01728c (patch)
tree32cde7fc141d8635b0f7f19bb093b43c688c58b4
parent83fa503079f7a049ffab9747b0360046474f3253 (diff)
downloadsequelpro-49bd7f5160135ec798aaad0b5944bb500e01728c.tar.gz
sequelpro-49bd7f5160135ec798aaad0b5944bb500e01728c.tar.bz2
sequelpro-49bd7f5160135ec798aaad0b5944bb500e01728c.zip
Remove KVO observers when closing the main window.
-rw-r--r--Source/SPConnectionController.m28
1 files changed, 24 insertions, 4 deletions
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