From 17f1adc78adf3b8b943dc36882855b901259d4c1 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 31 Oct 2011 20:07:00 +0100 Subject: rhbz#657394: crash closing document while printing - XRenderable implementation in SwXTextDocument and ScModelObj throw DisposedExceptions instead of RuntimeExceptions - SfxPrinterController catches DisposedException and aborts printing - vcl::PrinterController checks that the printing was not aborted --- sfx2/source/view/viewprn.cxx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 70c98d6a55bd..628c35686cc0 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -238,7 +238,16 @@ int SfxPrinterController::getPageCount() const if( mxRenderable.is() && pPrinter ) { Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() ); - nPages = mxRenderable->getRendererCount( getSelectionObject(), aJobOptions ); + try + { + nPages = mxRenderable->getRendererCount( getSelectionObject(), aJobOptions ); + } + catch (lang::DisposedException &) + { + OSL_TRACE("SfxPrinterController: document disposed while printing"); + const_cast(this)->setJobState( + view::PrintableState_JOB_ABORTED); + } } return nPages; } @@ -258,6 +267,12 @@ Sequence< beans::PropertyValue > SfxPrinterController::getPageParameters( int i_ catch( lang::IllegalArgumentException& ) { } + catch (lang::DisposedException &) + { + OSL_TRACE("SfxPrinterController: document disposed while printing"); + const_cast(this)->setJobState( + view::PrintableState_JOB_ABORTED); + } } return aResult; } @@ -277,6 +292,12 @@ void SfxPrinterController::printPage( int i_nPage ) const // don't care enough about nonexistant page here // to provoke a crash } + catch (lang::DisposedException &) + { + OSL_TRACE("SfxPrinterController: document disposed while printing"); + const_cast(this)->setJobState( + view::PrintableState_JOB_ABORTED); + } } } -- cgit