diff options
-rw-r--r-- | dbaccess/Library_dbu.mk | 1 | ||||
-rw-r--r-- | dbaccess/Library_dbui.mk | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppController.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 15 | ||||
-rw-r--r-- | sd/source/ui/view/DocumentRenderer.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 23 | ||||
-rw-r--r-- | sw/source/ui/uno/unotxdoc.cxx | 15 | ||||
-rw-r--r-- | unotools/Library_utl.mk | 1 | ||||
-rw-r--r-- | unotools/Package_inc.mk | 1 | ||||
-rw-r--r-- | unotools/inc/unotools/closeveto.hxx (renamed from dbaccess/source/ui/app/closeveto.hxx) | 12 | ||||
-rw-r--r-- | unotools/source/misc/closeveto.cxx (renamed from dbaccess/source/ui/app/closeveto.cxx) | 12 | ||||
-rw-r--r-- | vcl/Library_vclplug_gtk3.mk | 2 | ||||
-rw-r--r-- | vcl/generic/app/geninst.cxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 22 |
14 files changed, 96 insertions, 31 deletions
diff --git a/dbaccess/Library_dbu.mk b/dbaccess/Library_dbu.mk index 0f7ca599a7da..0419c297b368 100644 --- a/dbaccess/Library_dbu.mk +++ b/dbaccess/Library_dbu.mk @@ -107,7 +107,6 @@ $(eval $(call gb_Library_add_exception_objects,dbu,\ dbaccess/source/ui/app/AppSwapWindow \ dbaccess/source/ui/app/AppTitleWindow \ dbaccess/source/ui/app/AppView \ - dbaccess/source/ui/app/closeveto \ dbaccess/source/ui/app/subcomponentmanager \ dbaccess/source/ui/browser/AsyncronousLink \ dbaccess/source/ui/browser/brwctrlr \ diff --git a/dbaccess/Library_dbui.mk b/dbaccess/Library_dbui.mk index 7a9117aa1cbd..3c6bfb265da4 100644 --- a/dbaccess/Library_dbui.mk +++ b/dbaccess/Library_dbui.mk @@ -125,7 +125,6 @@ $(eval $(call gb_Library_add_exception_objects,dbui,\ dbaccess/source/ui/app/AppSwapWindow \ dbaccess/source/ui/app/AppTitleWindow \ dbaccess/source/ui/app/AppView \ - dbaccess/source/ui/app/closeveto \ dbaccess/source/ui/app/subcomponentmanager \ dbaccess/source/ui/browser/genericcontroller \ dbaccess/source/ui/browser/dsbrowserDnD \ diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index e02e1874f400..e530eae10acb 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -33,7 +33,6 @@ #include "dbustrings.hrc" #include "advancedsettingsdlg.hxx" #include "subcomponentmanager.hxx" -#include "closeveto.hxx" /** === begin UNO includes === **/ #include <com/sun/star/beans/NamedValue.hpp> @@ -104,6 +103,7 @@ #include <vcl/menu.hxx> #include <vcl/lstbox.hxx> +#include <unotools/closeveto.hxx> #include <unotools/pathoptions.hxx> #include <unotools/tempfile.hxx> #include <unotools/internaloptions.hxx> @@ -1962,7 +1962,7 @@ IMPL_LINK( OApplicationController, OnCreateWithPilot, void*, _pType ) // ----------------------------------------------------------------------------- void OApplicationController::newElementWithPilot( ElementType _eType ) { - CloseVeto aKeepDoc( getFrame() ); + utl::CloseVeto aKeepDoc( getFrame() ); // prevent the document being closed while the wizard is open OSL_ENSURE( getContainer(), "OApplicationController::newElementWithPilot: without a view?" ); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 4d4d5880a2a2..7332edab9b24 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -934,7 +934,10 @@ sal_Int32 SAL_CALL ScModelObj::getRendererCount( const uno::Any& aSelection, { SolarMutexGuard aGuard; if (!pDocShell) - throw uno::RuntimeException(); + { + throw lang::DisposedException( ::rtl::OUString(), + static_cast< sheet::XSpreadsheetDocument* >(this) ); + } ScMarkData aMark; ScPrintSelectionStatus aStatus; @@ -982,7 +985,10 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 { SolarMutexGuard aGuard; if (!pDocShell) - throw uno::RuntimeException(); + { + throw lang::DisposedException( ::rtl::OUString(), + static_cast< sheet::XSpreadsheetDocument* >(this) ); + } ScMarkData aMark; ScPrintSelectionStatus aStatus; @@ -1089,7 +1095,10 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec { SolarMutexGuard aGuard; if (!pDocShell) - throw uno::RuntimeException(); + { + throw lang::DisposedException( ::rtl::OUString(), + static_cast< sheet::XSpreadsheetDocument* >(this) ); + } ScMarkData aMark; ScPrintSelectionStatus aStatus; diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 4c9228d7e48c..e862c3c0b7fa 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1198,13 +1198,14 @@ class DocumentRenderer::Implementation { public: Implementation (ViewShellBase& rBase) - : mrBase(rBase), - mbIsDisposed(false), - mpPrinter(NULL), - mpOptions(), - maPrinterPages(), - mpPrintView(), - mbHasOrientationWarningBeenShown(false) + : mxObjectShell(rBase.GetDocShell()) + , mrBase(rBase) + , mbIsDisposed(false) + , mpPrinter(NULL) + , mpOptions() + , maPrinterPages() + , mpPrintView() + , mbHasOrientationWarningBeenShown(false) { DialogCreator aCreator( mrBase.GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ); m_aUIProperties = aCreator.GetDialogControls(); @@ -1400,6 +1401,8 @@ public: private: + // rhbz#657394: keep the document alive: prevents crash when + SfxObjectShellRef mxObjectShell; // destroying mpPrintView ViewShellBase& mrBase; bool mbIsDisposed; Printer* mpPrinter; 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); + } } } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 43f2400eabc5..c849fa7ab961 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2469,7 +2469,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( { SolarMutexGuard aGuard; if(!IsValid()) - throw RuntimeException(); + { + throw DisposedException( ::rtl::OUString(), + static_cast< XTextDocument* >(this) ); + } const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ); bool bIsSwSrcView = false; @@ -2633,7 +2636,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( { SolarMutexGuard aGuard; if(!IsValid()) - throw RuntimeException(); + { + throw DisposedException( ::rtl::OUString(), + static_cast< XTextDocument* >(this) ); + } const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ); bool bIsSwSrcView = false; @@ -2840,7 +2846,10 @@ void SAL_CALL SwXTextDocument::render( { SolarMutexGuard aGuard; if(!IsValid()) - throw RuntimeException(); + { + throw DisposedException( ::rtl::OUString(), + static_cast< XTextDocument* >(this) ); + } // due to #110067# (document page count changes sometimes during // PDF export/printing) we can not check for the upper bound properly. diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk index 9d9770849546..3937493899d5 100644 --- a/unotools/Library_utl.mk +++ b/unotools/Library_utl.mk @@ -131,6 +131,7 @@ $(eval $(call gb_Library_add_exception_objects,utl,\ unotools/source/i18n/textsearch \ unotools/source/i18n/transliterationwrapper \ unotools/source/misc/atom \ + unotools/source/misc/closeveto \ unotools/source/misc/componentresmodule \ unotools/source/misc/datetime \ unotools/source/misc/desktopterminationobserver \ diff --git a/unotools/Package_inc.mk b/unotools/Package_inc.mk index d1e177ddaa43..2c62667b8d74 100644 --- a/unotools/Package_inc.mk +++ b/unotools/Package_inc.mk @@ -37,6 +37,7 @@ $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/cacheoptions.hxx,uno $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/calendarwrapper.hxx,unotools/calendarwrapper.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/caserotate.hxx,unotools/caserotate.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/charclass.hxx,unotools/charclass.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/closeveto.hxx,unotools/closeveto.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/cmdoptions.hxx,unotools/cmdoptions.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/collatorwrapper.hxx,unotools/collatorwrapper.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/compatibility.hxx,unotools/compatibility.hxx)) diff --git a/dbaccess/source/ui/app/closeveto.hxx b/unotools/inc/unotools/closeveto.hxx index a9f1d6bf6c66..1fddd439ca04 100644 --- a/dbaccess/source/ui/app/closeveto.hxx +++ b/unotools/inc/unotools/closeveto.hxx @@ -25,10 +25,10 @@ * ************************************************************************/ -#ifndef DBACCESS_CLOSEVETO_HXX -#define DBACCESS_CLOSEVETO_HXX +#ifndef UNOTOOLS_CLOSEVETO_HXX +#define UNOTOOLS_CLOSEVETO_HXX -#include "dbaccessdllapi.h" +#include "unotools/unotoolsdllapi.h" /** === begin UNO includes === **/ #include <com/sun/star/uno/XInterface.hpp> @@ -37,7 +37,7 @@ #include <boost/scoped_ptr.hpp> //...................................................................................................................... -namespace dbaui +namespace utl { //...................................................................................................................... @@ -51,7 +51,7 @@ namespace dbaui If closing has been requested and vetoed while the <code>CloseVeto</code> instance is alive, and the ownership went to the <code>CloseVeto</code> instance, then it will close the component in its dtor. */ - class DBACCESS_DLLPRIVATE CloseVeto + class UNOTOOLS_DLLPUBLIC CloseVeto { public: CloseVeto( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_closeable ); @@ -65,6 +65,6 @@ namespace dbaui } // namespace dbaui //...................................................................................................................... -#endif // DBACCESS_CLOSEVETO_HXX +#endif // UNOTOOLS_CLOSEVETO_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/app/closeveto.cxx b/unotools/source/misc/closeveto.cxx index 588bdae48832..7a61a891fbd5 100644 --- a/dbaccess/source/ui/app/closeveto.cxx +++ b/unotools/source/misc/closeveto.cxx @@ -25,9 +25,9 @@ * ************************************************************************/ -#include "precompiled_dbaccess.hxx" +#include "precompiled_unotools.hxx" -#include "closeveto.hxx" +#include <unotools/closeveto.hxx> /** === begin UNO includes === **/ #include <com/sun/star/util/XCloseable.hpp> @@ -38,7 +38,7 @@ #include <tools/diagnose_ex.h> //...................................................................................................................... -namespace dbaui +namespace utl { //...................................................................................................................... @@ -65,7 +65,7 @@ namespace dbaui //================================================================================================================== typedef ::cppu::WeakImplHelper1 < XCloseListener > CloseListener_Base; - class DBACCESS_DLLPRIVATE CloseListener_Impl : public CloseListener_Base + class SAL_DLLPRIVATE CloseListener_Impl : public CloseListener_Base { public: CloseListener_Impl() @@ -117,7 +117,7 @@ namespace dbaui //================================================================================================================== //= CloseVeto_Data //================================================================================================================== - struct DBACCESS_DLLPRIVATE CloseVeto_Data + struct SAL_DLLPRIVATE CloseVeto_Data { Reference< XCloseable > xCloseable; ::rtl::Reference< CloseListener_Impl > pListener; @@ -177,7 +177,7 @@ namespace dbaui } //...................................................................................................................... -} // namespace dbaui +} // namespace utl //...................................................................................................................... /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk index 9c589ff71606..d328e81c1a67 100644 --- a/vcl/Library_vclplug_gtk3.mk +++ b/vcl/Library_vclplug_gtk3.mk @@ -79,7 +79,7 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_gtk3,\ $(gb_STDLIBS) \ )) -$(eval $(call gb_Library_use_externals,vclplug_gtk,\ +$(eval $(call gb_Library_use_externals,vclplug_gtk3,\ dbus \ )) diff --git a/vcl/generic/app/geninst.cxx b/vcl/generic/app/geninst.cxx index 24f49675778f..f958ea6450f1 100644 --- a/vcl/generic/app/geninst.cxx +++ b/vcl/generic/app/geninst.cxx @@ -65,6 +65,7 @@ void SalYieldMutex::acquire() void SalYieldMutex::release() { + OSL_ENSURE(mnCount > 0, "SalYieldMutex::release() called with zero count"); if ( mnThreadId == osl::Thread::getCurrentIdentifier() ) { if ( mnCount == 1 ) diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 6365b20abb2d..c2b0e876b227 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -626,6 +626,10 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: if( i_pController->isProgressCanceled() ) { i_pController->abortJob(); + } + if (i_pController->getJobState() == + view::PrintableState_JOB_ABORTED) + { bAborted = true; } } @@ -865,6 +869,11 @@ PrinterController::PageSize PrinterController::getPageFile( int i_nUnfilteredPag Sequence< PropertyValue > aPageParm( getPageParametersProtected( i_nUnfilteredPage ) ); const MapMode aMapMode( MAP_100TH_MM ); + if (mpImplData->meJobState != view::PrintableState_JOB_STARTED) + { // rhbz#657394: check that we are still printing... + return PrinterController::PageSize(); + } + mpImplData->mpPrinter->Push(); mpImplData->mpPrinter->SetMapMode( aMapMode ); @@ -951,6 +960,10 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte rMPS.nTopMargin == 0 && rMPS.nBottomMargin == 0 ) { PrinterController::PageSize aPageSize = getPageFile( i_nFilteredPage, o_rMtf, i_bMayUseCache ); + if (mpImplData->meJobState != view::PrintableState_JOB_STARTED) + { // rhbz#657394: check that we are still printing... + return PrinterController::PageSize(); + } Size aPaperSize = mpImplData->getRealPaperSize( aPageSize.aSize, true ); mpImplData->mpPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); mpImplData->mpPrinter->SetPaperSizeUser( aPaperSize, ! mpImplData->isFixedPageSize() ); @@ -996,6 +1009,10 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte o_rMtf.AddAction( new MetaMapModeAction( MapMode( MAP_100TH_MM ) ) ); int nDocPages = getPageCountProtected(); + if (mpImplData->meJobState != view::PrintableState_JOB_STARTED) + { // rhbz#657394: check that we are still printing... + return PrinterController::PageSize(); + } for( int nSubPage = 0; nSubPage < nSubPages; nSubPage++ ) { // map current sub page to real page @@ -1143,6 +1160,11 @@ void PrinterController::printFilteredPage( int i_nPage ) GDIMetaFile aPageFile; PrinterController::PageSize aPageSize = getFilteredPageFile( i_nPage, aPageFile ); + if (mpImplData->meJobState != view::PrintableState_JOB_STARTED) + { // rhbz#657394: check that we are still printing... + return; + } + if( mpImplData->mpProgress ) { // do nothing if printing is canceled |