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 | |
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
-rw-r--r-- | Source/SPHistoryController.h | 2 | ||||
-rw-r--r-- | Source/SPHistoryController.m | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/Source/SPHistoryController.h b/Source/SPHistoryController.h index 56303807..1b5ecaf3 100644 --- a/Source/SPHistoryController.h +++ b/Source/SPHistoryController.h @@ -64,7 +64,7 @@ enum sphistory_view_types // Loading history entries - (void) loadEntryAtPosition:(unsigned int)position; - (void) loadEntryTaskWithPosition:(NSNumber *)positionNumber; -- (void) abortEntryLoad; +- (void) abortEntryLoadWithPool:(NSAutoreleasePool *)pool; - (void) loadEntryFromMenuItem:(id)theMenuItem; // History entry details and description 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]; } /** |