From e22c6a289e98b6ee7889b41851cad6fff5b67361 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 5 Aug 2009 14:46:00 +0000 Subject: #i103253# #i103252# fix headless printing, duplicate free --- vcl/aqua/source/gdi/salprn.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'vcl/aqua/source/gdi/salprn.cxx') diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index 7a5b0c7ba483..b3bc494bde17 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -40,6 +40,7 @@ #include "vcl/salptype.hxx" #include "vcl/print.hxx" #include "vcl/unohelp.hxx" +#include "vcl/svapp.hxx" #include @@ -545,6 +546,8 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, beans::PropertyValue* pMonitor = i_rController.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MonitorVisible" ) ) ); if( pMonitor ) pMonitor->Value >>= bShowProgressPanel; + if( Application::IsHeadlessModeEnabled() ) + bShowProgressPanel = sal_False; // FIXME: jobStarted() should be done after the print dialog has ended (if there is one) // how do I know when that might be ? @@ -607,7 +610,10 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, [pPrintDict setObject: [[NSNumber numberWithInt: (int)i_rController.getPrinter()->GetCopyCount()] autorelease] forKey: NSPrintCopies]; [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting]; [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage]; - [pPrintDict setObject: [[NSNumber numberWithInt: mnCurPageRangeCount] autorelease] forKey: NSPrintLastPage]; + // #i103253# weird: for some reason, autoreleasing the value below like the others above + // leads do a double free malloc error. Why this value should behave differently from all the others + // is a mystery. + [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage]; // create print operation @@ -616,7 +622,7 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, if( pPrintOperation ) { NSObject* pReleaseAfterUse = nil; - bool bShowPanel = (! bIsQuickJob && getUseNativeDialog() ); + bool bShowPanel = (! bIsQuickJob && getUseNativeDialog() && ! Application::IsHeadlessModeEnabled() ); [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ]; [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO]; -- cgit