From 4831a67ec526909f6efd74545405e93891e11a45 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 4 Feb 2010 16:03:51 +0100 Subject: autorecovery: need to lock the SolarMutex when disposing, some of the dependent components might need this when they die --- reportdesign/source/core/api/ReportDefinition.cxx | 100 ++++++++++++---------- 1 file changed, 53 insertions(+), 47 deletions(-) (limited to 'reportdesign') diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 754f97bf0b4a..91917e03463c 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -805,55 +805,61 @@ void SAL_CALL OReportDefinition::dispose() throw(uno::RuntimeException) // ----------------------------------------------------------------------------- void SAL_CALL OReportDefinition::disposing() { - m_pImpl->m_aControllers.clear(); + notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnUnload"))); + uno::Reference< frame::XModel > xHoldAlive( this ); - { - notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnUnload"))); - - lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) ); - m_pImpl->m_aModifyListeners.disposeAndClear( aDisposeEvent ); - m_pImpl->m_aCloseListener.disposeAndClear( aDisposeEvent ); - m_pImpl->m_aDocEventListeners.disposeAndClear( aDisposeEvent ); - m_pImpl->m_aStorageChangeListeners.disposeAndClear( aDisposeEvent ); - - ::comphelper::disposeComponent(m_pImpl->m_xGroups); - m_pImpl->m_xReportHeader.clear(); - m_pImpl->m_xReportFooter.clear(); - m_pImpl->m_xPageHeader.clear(); - m_pImpl->m_xPageFooter.clear(); - m_pImpl->m_xDetail.clear(); - //::comphelper::disposeComponent(m_pImpl->m_xReportHeader); - //::comphelper::disposeComponent(m_pImpl->m_xReportFooter); - //::comphelper::disposeComponent(m_pImpl->m_xPageHeader); - //::comphelper::disposeComponent(m_pImpl->m_xPageFooter); - //::comphelper::disposeComponent(m_pImpl->m_xDetail); - ::comphelper::disposeComponent(m_pImpl->m_xFunctions); - - //::comphelper::disposeComponent(m_pImpl->m_xStorage); - // don't dispose, this currently is the task of either the ref count going to - // 0, or of the embedded object (if we're embedded, which is the only possible - // case so far) - // #i78366# / 2007-06-18 / frank.schoenheit@sun.com - m_pImpl->m_xStorage.clear(); - m_pImpl->m_xViewData.clear(); - m_pImpl->m_xCurrentController.clear(); - m_pImpl->m_xNumberFormatsSupplier.clear(); - m_pImpl->m_xStyles.clear(); - m_pImpl->m_xXMLNamespaceMap.clear(); - m_pImpl->m_xGradientTable.clear(); - m_pImpl->m_xHatchTable.clear(); - m_pImpl->m_xBitmapTable.clear(); - m_pImpl->m_xTransparencyGradientTable.clear(); - m_pImpl->m_xDashTable.clear(); - m_pImpl->m_xMarkerTable.clear(); - m_pImpl->m_xUIConfigurationManager.clear(); - m_pImpl->m_pReportModel.reset(); - m_pImpl->m_pObjectContainer.reset(); - m_pImpl->m_aArgs.realloc(0); - m_pImpl->m_xTitleHelper.clear(); - m_pImpl->m_xNumberedControllers.clear(); - } + + lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) ); + m_pImpl->m_aModifyListeners.disposeAndClear( aDisposeEvent ); + m_pImpl->m_aCloseListener.disposeAndClear( aDisposeEvent ); + m_pImpl->m_aDocEventListeners.disposeAndClear( aDisposeEvent ); + m_pImpl->m_aStorageChangeListeners.disposeAndClear( aDisposeEvent ); + + // SYNCHRONIZED ---> + vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::ResettableMutexGuard aGuard(m_aMutex); + + m_pImpl->m_aControllers.clear(); + + ::comphelper::disposeComponent(m_pImpl->m_xGroups); + m_pImpl->m_xReportHeader.clear(); + m_pImpl->m_xReportFooter.clear(); + m_pImpl->m_xPageHeader.clear(); + m_pImpl->m_xPageFooter.clear(); + m_pImpl->m_xDetail.clear(); + //::comphelper::disposeComponent(m_pImpl->m_xReportHeader); + //::comphelper::disposeComponent(m_pImpl->m_xReportFooter); + //::comphelper::disposeComponent(m_pImpl->m_xPageHeader); + //::comphelper::disposeComponent(m_pImpl->m_xPageFooter); + //::comphelper::disposeComponent(m_pImpl->m_xDetail); + ::comphelper::disposeComponent(m_pImpl->m_xFunctions); + + //::comphelper::disposeComponent(m_pImpl->m_xStorage); + // don't dispose, this currently is the task of either the ref count going to + // 0, or of the embedded object (if we're embedded, which is the only possible + // case so far) + // #i78366# / 2007-06-18 / frank.schoenheit@sun.com + m_pImpl->m_xStorage.clear(); + m_pImpl->m_xViewData.clear(); + m_pImpl->m_xCurrentController.clear(); + m_pImpl->m_xNumberFormatsSupplier.clear(); + m_pImpl->m_xStyles.clear(); + m_pImpl->m_xXMLNamespaceMap.clear(); + m_pImpl->m_xGradientTable.clear(); + m_pImpl->m_xHatchTable.clear(); + m_pImpl->m_xBitmapTable.clear(); + m_pImpl->m_xTransparencyGradientTable.clear(); + m_pImpl->m_xDashTable.clear(); + m_pImpl->m_xMarkerTable.clear(); + m_pImpl->m_xUIConfigurationManager.clear(); + m_pImpl->m_pReportModel.reset(); + m_pImpl->m_pObjectContainer.reset(); + m_pImpl->m_aArgs.realloc(0); + m_pImpl->m_xTitleHelper.clear(); + m_pImpl->m_xNumberedControllers.clear(); + // <--- SYNCHRONIZED } + // ----------------------------------------------------------------------------- ::rtl::OUString OReportDefinition::getImplementationName_Static( ) throw(uno::RuntimeException) { -- cgit From abb51ede006041a8e5db1bb0463484d2a98698df Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 4 Feb 2010 22:49:44 +0100 Subject: autorecovery: derive XReportDefinition from XModifiable2, extending XModifiable --- reportdesign/inc/ReportDefinition.hxx | 5 +++ reportdesign/source/core/api/ReportDefinition.cxx | 38 +++++++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'reportdesign') diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx index ec9a5c4f5248..6048ab1d6625 100644 --- a/reportdesign/inc/ReportDefinition.hxx +++ b/reportdesign/inc/ReportDefinition.hxx @@ -314,6 +314,11 @@ namespace reportdesign virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getMapUnit( ::sal_Int64 nAspect ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + // XModifiable2 + virtual ::sal_Bool SAL_CALL disableSetModified( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL enableSetModified( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isSetModifiedEnabled( ) throw (::com::sun::star::uno::RuntimeException); + // XModifiable virtual ::sal_Bool SAL_CALL isModified( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setModified( ::sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException); diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 91917e03463c..b0ee87512a31 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -626,6 +626,7 @@ struct OReportDefinitionImpl sal_Bool m_bControllersLocked; sal_Bool m_bModified; sal_Bool m_bEscapeProcessing; + sal_Bool m_bSetModifiedEnabled; OReportDefinitionImpl(::osl::Mutex& _aMutex) :m_aStorageChangeListeners(_aMutex) ,m_aCloseListener(_aMutex) @@ -643,6 +644,7 @@ struct OReportDefinitionImpl ,m_bControllersLocked(sal_False) ,m_bModified(sal_False) ,m_bEscapeProcessing(sal_True) + ,m_bSetModifiedEnabled( sal_True ) {} OReportDefinitionImpl(::osl::Mutex& _aMutex,const OReportDefinitionImpl& _aCopy) @@ -1953,6 +1955,38 @@ embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepres { return embed::EmbedMapUnits::ONE_100TH_MM; } +// ----------------------------------------------------------------------------- +// XModifiable +::sal_Bool SAL_CALL OReportDefinition::disableSetModified( ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed ); + + const sal_Bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled; + m_pImpl->m_bSetModifiedEnabled = sal_False; + return bWasEnabled; +} + +// ----------------------------------------------------------------------------- +::sal_Bool SAL_CALL OReportDefinition::enableSetModified( ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed ); + + const sal_Bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled; + m_pImpl->m_bSetModifiedEnabled = sal_True; + return bWasEnabled; +} + +// ----------------------------------------------------------------------------- +::sal_Bool SAL_CALL OReportDefinition::isSetModifiedEnabled( ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed ); + + return m_pImpl->m_bSetModifiedEnabled; +} + // ----------------------------------------------------------------------------- // XModifiable ::sal_Bool SAL_CALL OReportDefinition::isModified( ) throw (uno::RuntimeException) @@ -1966,6 +2000,10 @@ void SAL_CALL OReportDefinition::setModified( ::sal_Bool _bModified ) throw (bea { ::osl::ResettableMutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); + + if ( !m_pImpl->m_bSetModifiedEnabled ) + return; + if ( m_pImpl->m_pReportModel->IsReadOnly() && _bModified ) throw beans::PropertyVetoException(); if ( m_pImpl->m_bModified != _bModified ) -- cgit