From c2351f2220ac01cac614de93bad05022d89d7790 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 23 Mar 2010 21:08:33 +0000 Subject: - Remove observers for key paths when dealloc'ing objects to fix later crashes when changing those keyvalues (eg changing query editor background colour after closing windows - http://log.sequelpro.com/view/44 ) - Fix a memory leak of a prefs reference in CMTextView --- Source/CMTextView.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Source/CMTextView.m') diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 2a5c43c7..3ea60174 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -3225,7 +3225,24 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) - (void) dealloc { + + // Remove observers [[NSNotificationCenter defaultCenter] removeObserver:self]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorFont]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorBackgroundColor]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorHighlightQueryColor]; + [prefs removeObserver:self forKeyPath:SPCustomQueryHighlightCurrentQuery]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorCommentColor]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorQuoteColor]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorSQLKeywordColor]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorBacktickColor]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorNumericColor]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorVariableColor]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorTextColor]; + [prefs removeObserver:self forKeyPath:SPCustomQueryEditorTabStopWidth]; + [prefs removeObserver:self forKeyPath:SPCustomQueryAutoUppercaseKeywords]; + + [prefs release]; [lineNumberView release]; if(queryHiliteColor) [queryHiliteColor release]; if(queryEditorBackgroundColor) [queryEditorBackgroundColor release]; -- cgit v1.2.3