diff options
author | Michael Stahl <mstahl@redhat.com> | 2011-10-31 20:07:00 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2011-10-31 20:07:00 +0100 |
commit | 17f1adc78adf3b8b943dc36882855b901259d4c1 (patch) | |
tree | 7895270aedbf556664c1005f45523d58ac4db2d1 /sfx2 | |
parent | 6c6050237bfe6152de1371a56a65add4f70bb81c (diff) |
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
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 23 |
1 files changed, 22 insertions, 1 deletions
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<SfxPrinterController*>(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<SfxPrinterController*>(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<SfxPrinterController*>(this)->setJobState( + view::PrintableState_JOB_ABORTED); + } } } |