diff options
author | rowanbeentje <rowan@beent.je> | 2009-12-13 20:56:12 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-12-13 20:56:12 +0000 |
commit | 5298595375e55bb70edae0ddf17d921a299b1014 (patch) | |
tree | aee7d92e5c6b5b99a6f099db3c6b20cef7e59ce1 /Source/SPHistoryController.m | |
parent | d0add86e1e7f6b315dd9d62d97d911f6dacef33c (diff) | |
download | sequelpro-5298595375e55bb70edae0ddf17d921a299b1014.tar.gz sequelpro-5298595375e55bb70edae0ddf17d921a299b1014.tar.bz2 sequelpro-5298595375e55bb70edae0ddf17d921a299b1014.zip |
- Fix issues causing memory leaks and causing history load tasks never to complete when loading certain history entries - this addresses Issue #499
Diffstat (limited to 'Source/SPHistoryController.m')
-rw-r--r-- | Source/SPHistoryController.m | 14 |
1 files changed, 9 insertions, 5 deletions
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]; } /** |