diff options
author | stuconnolly <stuart02@gmail.com> | 2010-03-13 22:04:52 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-03-13 22:04:52 +0000 |
commit | d826eabb4a3716873ab8f3d938896dda5eefbaab (patch) | |
tree | 4b1ba040d372526d2c614bf08d97155234cc152c | |
parent | eb10ee0dd4759e18ed1aee8b119d6e2bafeba8ef (diff) | |
download | sequelpro-d826eabb4a3716873ab8f3d938896dda5eefbaab.tar.gz sequelpro-d826eabb4a3716873ab8f3d938896dda5eefbaab.tar.bz2 sequelpro-d826eabb4a3716873ab8f3d938896dda5eefbaab.zip |
Add additional thread cancellation checking when generating HTML for printing to ensure the current thread is not the main thread.
-rw-r--r-- | Source/SPPrintController.m | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/SPPrintController.m b/Source/SPPrintController.m index 2c40eda9..64354076 100644 --- a/Source/SPPrintController.m +++ b/Source/SPPrintController.m @@ -98,9 +98,7 @@ * Loads the print document interface. The actual printing is done in the doneLoading delegate. */ - (IBAction)printDocument:(id)sender -{ - NSString *HTMLString = @""; - +{ if (printThread) [printThread release]; [self startTaskWithDescription:NSLocalizedString(@"Generating print document...", @"generating print document status message")]; @@ -234,7 +232,7 @@ rows = [[NSArray alloc] initWithArray: [data objectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1, ([data count] - 1))]] - ]; + ]; } [engine setObject:connection forKey:@"c"]; @@ -250,7 +248,7 @@ NSString *HTMLString = [engine processTemplateInFileAtPath:[[NSBundle mainBundle] pathForResource:SPHTMLPrintTemplate ofType:@"html"] withVariables:printData]; // Check if the operation has been cancelled - if ([printThread isCancelled]) { + if ((printThread != nil) && (![NSThread isMainThread]) && ([printThread isCancelled])) { [pool drain]; [self endTask]; @@ -288,7 +286,7 @@ [printData setObject:[[NSUnarchiver unarchiveObjectWithData:[prefs objectForKey:SPCustomQueryEditorFont]] fontName] forKey:@"font"]; // Check if the operation has been cancelled - if ([printThread isCancelled]) { + if ((printThread != nil) && (![NSThread isMainThread]) && ([printThread isCancelled])) { [pool drain]; [self endTask]; |