aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/TableDocument.m18
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: