diff options
author | rowanbeentje <rowan@beent.je> | 2010-04-12 22:01:44 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-04-12 22:01:44 +0000 |
commit | 688345df80bb228e9c26b13ccec0710850223123 (patch) | |
tree | 8ffc579b020361c25bc9d3a4f484544d8d736de9 /Source/CMTextView.m | |
parent | bc1f5c488f532023c5ebb545449e05409b19cded (diff) | |
download | sequelpro-688345df80bb228e9c26b13ccec0710850223123.tar.gz sequelpro-688345df80bb228e9c26b13ccec0710850223123.tar.bz2 sequelpro-688345df80bb228e9c26b13ccec0710850223123.zip |
Review usage of notifications, afterDelay: and waitUntilDone:NO calls:
- Add more calls to deregister watchers to fix crashes to closing threads or objects
- Fix a couple of memory leaks
- Alter a few calls to be performed on main thread (afterDelay: operates on the thread is is called on) - this fixed database reloading after import and field/index deletion error sheets
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r-- | Source/CMTextView.m | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 75839bc8..0b2ca6d3 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -2940,12 +2940,12 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) // Start autohelp only if the user really changed the text (not e.g. for setting a background color) if([prefs boolForKey:SPCustomQueryUpdateAutoHelp] && editedMask != 1) { - [self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[[prefs valueForKey:SPCustomQueryAutoHelpDelay] retain] doubleValue]]; + [self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[prefs valueForKey:SPCustomQueryAutoHelpDelay] doubleValue]]; } // Start autocompletion if enabled if([[NSApp keyWindow] firstResponder] == self && [prefs boolForKey:SPCustomQueryAutoComplete] && !completionIsOpen && editedMask != 1 && [textStore editedRange].length) - [self performSelector:@selector(doAutoCompletion) withObject:nil afterDelay:[[[prefs valueForKey:SPCustomQueryAutoCompleteDelay] retain] doubleValue]]; + [self performSelector:@selector(doAutoCompletion) withObject:nil afterDelay:[[prefs valueForKey:SPCustomQueryAutoCompleteDelay] doubleValue]]; // Cancel calling doSyntaxHighlighting for large text if([[self string] length] > SP_TEXT_SIZE_TRIGGER_FOR_PARTLY_PARSING) @@ -3281,15 +3281,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) - (void) dealloc { - if([prefs boolForKey:SPCustomQueryUpdateAutoHelp]) - [NSObject cancelPreviousPerformRequestsWithTarget:self - selector:@selector(autoHelp) - object:nil]; - - if([prefs boolForKey:SPCustomQueryAutoComplete]) - [NSObject cancelPreviousPerformRequestsWithTarget:self - selector:@selector(doAutoCompletion) - object:nil]; + // Cancel any deferred calls + [NSObject cancelPreviousPerformRequestsWithTarget:self]; // Remove observers [[NSNotificationCenter defaultCenter] removeObserver:self]; |