aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPNarrowDownCompletion.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-04-22 21:20:16 +0000
committerrowanbeentje <rowan@beent.je>2010-04-22 21:20:16 +0000
commit2124b2987a31ad704adb5eb68157cd2b1f396ccf (patch)
tree663f3ddc13eaed15b9e98a889b85789f83402667 /Source/SPNarrowDownCompletion.m
parentd7a60be55db3fa16565c888351af4a2142e7b751 (diff)
downloadsequelpro-2124b2987a31ad704adb5eb68157cd2b1f396ccf.tar.gz
sequelpro-2124b2987a31ad704adb5eb68157cd2b1f396ccf.tar.bz2
sequelpro-2124b2987a31ad704adb5eb68157cd2b1f396ccf.zip
- Allow CMTextView to track SPNarrowDownCompletion state, ensuring old windows are closed. This also allows SPNarrowDownCompletion to be closed when CMTextView is deallocated; this should fix http://spbug.com/l/139 .
- Fix some minor memory leaks
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r--Source/SPNarrowDownCompletion.m29
1 files changed, 21 insertions, 8 deletions
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index c76c06e6..50b4e953 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -118,6 +118,8 @@
filtered = nil;
spaceCounter = 0;
currentSyncImage = 0;
+ staticPrefix = nil;
+ suggestions = nil;
commonPrefixWasInsertedByAutoComplete = NO;
prefs = [NSUserDefaults standardUserDefaults];
originalFilterString = [[NSMutableString alloc] init];
@@ -127,12 +129,12 @@
[self setupInterface];
syncArrowImages = [[NSArray alloc] initWithObjects:
- [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_01" ofType:@"tiff"]],
- [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_02" ofType:@"tiff"]],
- [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_03" ofType:@"tiff"]],
- [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_04" ofType:@"tiff"]],
- [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_05" ofType:@"tiff"]],
- [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_06" ofType:@"tiff"]],
+ [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_01" ofType:@"tiff"]] autorelease],
+ [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_02" ofType:@"tiff"]] autorelease],
+ [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_03" ofType:@"tiff"]] autorelease],
+ [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_04" ofType:@"tiff"]] autorelease],
+ [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_05" ofType:@"tiff"]] autorelease],
+ [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sync_arrows_06" ofType:@"tiff"]] autorelease],
nil];
}
@@ -147,10 +149,11 @@
[stateTimer release];
}
stateTimer = nil;
- [staticPrefix release];
+ if (staticPrefix) [staticPrefix release];
[mutablePrefix release];
[textualInputCharacters release];
[originalFilterString release];
+ [syncArrowImages release];
if(suggestions) [suggestions release];
if (filtered) [filtered release];
@@ -158,6 +161,13 @@
[super dealloc];
}
+- (void)close
+{
+ closeMe = YES;
+ [theView setCompletionIsOpen:NO];
+ [super close];
+}
+
- (void)updateSyncArrowStatus
{
// update sync arrow image
@@ -331,7 +341,7 @@
[theTableView setHeaderView:nil];
NSTableColumn *column0 = [[[NSTableColumn alloc] initWithIdentifier:@"image"] autorelease];
- [column0 setDataCell:[NSImageCell new]];
+ [column0 setDataCell:[[NSImageCell new] autorelease]];
[theTableView addTableColumn:column0];
[column0 setMinWidth:0];
[column0 setWidth:20];
@@ -758,6 +768,9 @@
if(!event)
continue;
+
+ // Exit if closeMe has been set in the meantime
+ if(closeMe) return;
NSEventType t = [event type];
if([theTableView SP_NarrowDownCompletion_canHandleEvent:event])