diff options
author | rowanbeentje <rowan@beent.je> | 2009-11-09 14:24:21 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-11-09 14:24:21 +0000 |
commit | 3e5038fa11598fde4b424008888dad20a048c755 (patch) | |
tree | 4d747c9542367bf36cbd860919290b0f45810f8b /Source/TableDocument.m | |
parent | 68421a460b9e982316f02cae741779a3a7a8bf13 (diff) | |
download | sequelpro-3e5038fa11598fde4b424008888dad20a048c755.tar.gz sequelpro-3e5038fa11598fde4b424008888dad20a048c755.tar.bz2 sequelpro-3e5038fa11598fde4b424008888dad20a048c755.zip |
- Wrap SPF restoreSession: call in a task, using the new nested task support to fix issue #452
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index d17ee1e2..a8a71e8b 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -500,11 +500,15 @@ */ - (void)restoreSession { + NSAutoreleasePool *taskPool = [[NSAutoreleasePool alloc] init]; // Check and set the table NSArray *tables = [tablesListInstance tables]; - if([tables indexOfObject:[spfSession objectForKey:@"table"]] == NSNotFound) return; + if([tables indexOfObject:[spfSession objectForKey:@"table"]] == NSNotFound) { + [taskPool drain]; + return; + } // Restore toolbar setting if([spfSession objectForKey:@"isToolbarVisible"]) @@ -559,6 +563,9 @@ [spfSession release]; spfSession = nil; + // End the task + [self endTask]; + [taskPool drain]; } /** @@ -691,7 +698,14 @@ [tableWindow makeFirstResponder:[tablesListInstance valueForKeyPath:@"tablesListView"]]; if(spfSession != nil) { - [self restoreSession]; + + // Start a task to restore the session details + [self startTaskWithDescription:NSLocalizedString(@"Restoring session...", @"Restoring session task description")]; + if ([NSThread isMainThread]) { + [NSThread detachNewThreadSelector:@selector(restoreSession) toTarget:self withObject:nil]; + } else { + [self restoreSession]; + } } else { switch ([prefs integerForKey:SPDefaultViewMode] > 0 ? [prefs integerForKey:SPDefaultViewMode] : [prefs integerForKey:SPLastViewMode]) { default: |