diff options
-rw-r--r-- | chart2/source/controller/main/ChartController.cxx | 2 | ||||
-rw-r--r-- | chart2/source/inc/LifeTime.hxx | 4 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 4 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel_Persistence.cxx | 4 | ||||
-rw-r--r-- | chart2/source/tools/LifeTime.cxx | 22 |
5 files changed, 22 insertions, 14 deletions
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 26f2a1c8f..2937b3c49 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -874,7 +874,7 @@ void ChartController::impl_deleteDrawViewController() throw(uno::RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex()); - if( m_aLifeTimeManager.impl_isDisposed() ) + if( m_aLifeTimeManager.impl_isDisposed(false) ) return; //behave passive if already disposed or suspended //--remove listener diff --git a/chart2/source/inc/LifeTime.hxx b/chart2/source/inc/LifeTime.hxx index 8c695cf5a..7c23a1286 100644 --- a/chart2/source/inc/LifeTime.hxx +++ b/chart2/source/inc/LifeTime.hxx @@ -52,7 +52,7 @@ public: OOO_DLLPUBLIC_CHARTTOOLS LifeTimeManager( ::com::sun::star::lang::XComponent* pComponent, sal_Bool bLongLastingCallsCancelable = sal_False ); OOO_DLLPUBLIC_CHARTTOOLS virtual ~LifeTimeManager(); -OOO_DLLPUBLIC_CHARTTOOLS sal_Bool impl_isDisposed(); +OOO_DLLPUBLIC_CHARTTOOLS bool impl_isDisposed( bool bAssert=true ); OOO_DLLPUBLIC_CHARTTOOLS sal_Bool dispose() throw(::com::sun::star::uno::RuntimeException); public: @@ -105,7 +105,7 @@ OOO_DLLPUBLIC_CHARTTOOLS CloseableLifeTimeManager( ::com::sun::star::util::XClos , sal_Bool bLongLastingCallsCancelable = sal_False ); OOO_DLLPUBLIC_CHARTTOOLS virtual ~CloseableLifeTimeManager(); -OOO_DLLPUBLIC_CHARTTOOLS sal_Bool impl_isDisposedOrClosed(); +OOO_DLLPUBLIC_CHARTTOOLS bool impl_isDisposedOrClosed( bool bAssert=true ); OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_close_startTryClose(sal_Bool bDeliverOwnership) throw ( ::com::sun::star::uno::Exception ); OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_close_isNeedToCancelLongLastingCalls( sal_Bool bDeliverOwnership, ::com::sun::star::util::CloseVetoException& ex ) diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index a5f390ee7..5323441d5 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -550,7 +550,7 @@ void SAL_CALL ChartModel::addEventListener( const uno::Reference< lang::XEventLi void SAL_CALL ChartModel::removeEventListener( const uno::Reference< lang::XEventListener > & xListener ) throw(uno::RuntimeException) { - if( m_aLifeTimeManager.impl_isDisposedOrClosed() ) + if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) ) return; //behave passive if already disposed or closed m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< lang::XEventListener >*)0), xListener ); @@ -569,7 +569,7 @@ void SAL_CALL ChartModel::addCloseListener( const uno::Reference< util::XCloseLi void SAL_CALL ChartModel::removeCloseListener( const uno::Reference< util::XCloseListener > & xListener ) throw(uno::RuntimeException) { - if( m_aLifeTimeManager.impl_isDisposedOrClosed() ) + if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) ) return; //behave passive if already disposed or closed m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< util::XCloseListener >*)0), xListener ); diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index b6b9291ce..9923dd4ac 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -746,7 +746,7 @@ void SAL_CALL ChartModel::removeModifyListener( const uno::Reference< util::XModifyListener >& xListener ) throw(uno::RuntimeException) { - if( m_aLifeTimeManager.impl_isDisposedOrClosed() ) + if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) ) return; //behave passive if already disposed or closed m_aLifeTimeManager.m_aListenerContainer.removeInterface( @@ -845,7 +845,7 @@ void SAL_CALL ChartModel::addStorageChangeListener( const Reference< document::X void SAL_CALL ChartModel::removeStorageChangeListener( const Reference< document::XStorageChangeListener >& xListener ) throw (uno::RuntimeException) { - if( m_aLifeTimeManager.impl_isDisposedOrClosed() ) + if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) ) return; //behave passive if already disposed or closed m_aLifeTimeManager.m_aListenerContainer.removeInterface( diff --git a/chart2/source/tools/LifeTime.cxx b/chart2/source/tools/LifeTime.cxx index 46bf42730..c49010653 100644 --- a/chart2/source/tools/LifeTime.cxx +++ b/chart2/source/tools/LifeTime.cxx @@ -62,12 +62,15 @@ LifeTimeManager::~LifeTimeManager() { } - sal_Bool LifeTimeManager -::impl_isDisposed() +bool LifeTimeManager::impl_isDisposed( bool bAssert ) { if( m_bDisposed || m_bInDispose ) { - OSL_ENSURE( sal_False, "This component is already disposed " ); + if( bAssert ) + { + OSL_ENSURE( sal_False, "This component is already disposed " ); + (void)(bAssert); + } return sal_True; } return sal_False; @@ -185,15 +188,18 @@ CloseableLifeTimeManager::~CloseableLifeTimeManager() { } - sal_Bool CloseableLifeTimeManager -::impl_isDisposedOrClosed() +bool CloseableLifeTimeManager::impl_isDisposedOrClosed( bool bAssert ) { - if( impl_isDisposed() ) + if( impl_isDisposed( bAssert ) ) return sal_True; if( m_bClosed ) { - OSL_ENSURE( sal_False, "This object is already closed" ); + if( bAssert ) + { + OSL_ENSURE( sal_False, "This object is already closed" ); + (void)(bAssert);//avoid warnings + } return sal_True; } return sal_False; @@ -206,6 +212,8 @@ CloseableLifeTimeManager::~CloseableLifeTimeManager() //no mutex is allowed to be acquired { osl::ResettableGuard< osl::Mutex > aGuard( m_aAccessMutex ); + if( impl_isDisposedOrClosed(false) ) + return sal_False; //Mutex needs to be acquired exactly ones; will be released inbetween if( !impl_canStartApiCall() ) |