aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPBundleHTMLOutputController.m6
-rw-r--r--Source/SPDatabaseDocument.m28
-rw-r--r--Source/SPTableContent.m2
3 files changed, 24 insertions, 12 deletions
diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m
index 6d9f70be..e6e5980e 100644
--- a/Source/SPBundleHTMLOutputController.m
+++ b/Source/SPBundleHTMLOutputController.m
@@ -197,7 +197,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument";
- (IBAction)printDocument:(id)sender
{
-
+#warning duplicate code with -[SPDatabaseDocument webView:didFinishLoadForFrame:]
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
NSSize paperSize = [printInfo paperSize];
@@ -225,8 +225,8 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument";
NSPrintOperation *op = [NSPrintOperation printOperationWithView:[[[webView mainFrame] frameView] documentView] printInfo:printInfo];
- // Perform the print operation on a background thread
- [op setCanSpawnSeparateThread:YES];
+ // do not try to use webkit from a background thread!
+ [op setCanSpawnSeparateThread:NO];
// Add the ability to select the orientation to print panel
NSPrintPanel *printPanel = [op printPanel];
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 41f4e078..b67728c2 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -79,9 +79,7 @@
#import "SPBundleHTMLOutputController.h"
#endif
#import "SPTableTriggers.h"
-#ifdef SP_CODA /* headers */
#import "SPTableStructure.h"
-#endif
#import "SPPrintAccessory.h"
#import "MGTemplateEngine.h"
#import "ICUTemplateMatcher.h"
@@ -7279,8 +7277,8 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
NSPrintOperation *op = [NSPrintOperation printOperationWithView:[[[printWebView mainFrame] frameView] documentView] printInfo:printInfo];
- // Perform the print operation on a background thread
- [op setCanSpawnSeparateThread:YES];
+ // do not try to use webkit from a background thread!
+ [op setCanSpawnSeparateThread:NO];
// Add the ability to select the orientation to print panel
NSPrintPanel *printPanel = [op printPanel];
@@ -7297,12 +7295,22 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
[op setPrintPanel:printPanel];
- [op runOperationModalForWindow:[self parentWindow]
- delegate:self
- didRunSelector:nil
- contextInfo:nil];
-
+ /* -endTask has to be called first, since the toolbar caches the item enabled state before starting a sheet,
+ * disables all items and restores the cached state after the sheet ends. Because the database chooser is disabled
+ * during tasks, launching the sheet before calling -endTask first would result in the following flow:
+ * - toolbar item caches database chooser state as disabled (because of the active task)
+ * - sheet is shown
+ * - endTask reenables database chooser (has no effect because of the open sheet)
+ * - user dismisses sheet after some time
+ * - toolbar item restores cached state and disables database chooser again
+ * => Inconsistent UI: database chooser disabled when it should actually be enabled
+ */
if ([self isWorking]) [self endTask];
+
+ [op runOperationModalForWindow:[self parentWindow]
+ delegate:self
+ didRunSelector:nil
+ contextInfo:nil];
}
/**
@@ -7590,6 +7598,8 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
/**
* Returns an array of columns for whichever view is being printed.
+ *
+ * MUST BE CALLED ON THE UI THREAD!
*/
- (NSArray *)columnNames
{
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 16f5ac99..72bdb8e1 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -2373,6 +2373,8 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
/**
* Returns the current result (as shown in table content view) as array, the first object containing the field
* names as array, the following objects containing the rows as array.
+ *
+ * MUST BE CALLED ON THE UI THREAD!
*/
- (NSArray *)currentDataResultWithNULLs:(BOOL)includeNULLs hideBLOBs:(BOOL)hide
{