From 5298595375e55bb70edae0ddf17d921a299b1014 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 13 Dec 2009 20:56:12 +0000 Subject: - Fix issues causing memory leaks and causing history load tasks never to complete when loading certain history entries - this addresses Issue #499 --- Source/SPHistoryController.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'Source/SPHistoryController.m') diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m index 7644f97f..17f2d3d7 100644 --- a/Source/SPHistoryController.m +++ b/Source/SPHistoryController.m @@ -301,6 +301,8 @@ [tableContentInstance loadTable:[historyEntry objectForKey:@"table"]]; modifyingHistoryState = NO; [self updateToolbarItem]; + [theDocument endTask]; + [loadPool drain]; return; } @@ -314,7 +316,7 @@ [chooseDatabaseButton selectItemWithTitle:[historyEntry objectForKey:@"database"]]; [theDocument chooseDatabase:self]; if (![[theDocument database] isEqualToString:[historyEntry objectForKey:@"database"]]) { - return [self abortEntryLoad]; + return [self abortEntryLoadWithPool:loadPool]; } } @@ -322,11 +324,11 @@ if ([historyEntry objectForKey:@"table"] && ![[theDocument table] isEqualToString:[historyEntry objectForKey:@"table"]]) { NSArray *tables = [tablesListInstance tables]; if ([tables indexOfObject:[historyEntry objectForKey:@"table"]] == NSNotFound) { - return [self abortEntryLoad]; + return [self abortEntryLoadWithPool:loadPool]; } [[tablesListInstance valueForKey:@"tablesListView"] selectRowIndexes:[NSIndexSet indexSetWithIndex:[tables indexOfObject:[historyEntry objectForKey:@"table"]]] byExtendingSelection:NO]; if (![[theDocument table] isEqualToString:[historyEntry objectForKey:@"table"]]) { - return [self abortEntryLoad]; + return [self abortEntryLoadWithPool:loadPool]; } } else if (![historyEntry objectForKey:@"table"] && [theDocument table]) { [tablesListInstance setTableListSelectability:YES]; @@ -355,7 +357,7 @@ break; } if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] intValue]) { - return [self abortEntryLoad]; + return [self abortEntryLoadWithPool:loadPool]; } } @@ -371,10 +373,12 @@ * Convenience method for aborting history load - could at some point * clean up the history list, show an alert, etc */ -- (void) abortEntryLoad +- (void) abortEntryLoadWithPool:(NSAutoreleasePool *)pool { NSBeep(); modifyingHistoryState = NO; + [theDocument endTask]; + if (pool) [pool drain]; } /** -- cgit v1.2.3