diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-31 15:31:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-31 18:37:34 +0200 |
commit | 009b889616561176a230bc041699271697f95bf6 (patch) | |
tree | e6c44c7b552f8a0764ce2e5a1afe9483dff5bcb4 /package/source | |
parent | 046e37faa295889157f0313f2300d93cb0f83b9e (diff) |
do not throw DisposedException when inside a dispose() method
There is no need to do this, as the documentation of
css.lang.XComponent::dispose at
udkapi/com/sun/star/lang/XComponent.idl
states:
After this method has been called, the object should
behave as passive as possible, thus it should ignore all calls
Otherwise, the effect of throwing here is mostly to disturb the flow of
logic in caller code, preventing other parts of teardown from proceeding
smoothly.
Change-Id: I30e6d1b35f85b727debf4405a995fdc0a4fccde6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152450
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package/source')
-rw-r--r-- | package/source/xstor/ocompinstream.cxx | 10 | ||||
-rw-r--r-- | package/source/xstor/xstorage.cxx | 10 |
2 files changed, 4 insertions, 16 deletions
diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx index ef6bea3e8b06..b5931c0c0918 100644 --- a/package/source/xstor/ocompinstream.cxx +++ b/package/source/xstor/ocompinstream.cxx @@ -185,10 +185,7 @@ void OInputCompStream::InternalDispose() // can be called only by OWriteStream_Impl ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) - { - SAL_INFO("package.xstor", "Disposed!"); - throw lang::DisposedException(); - } + return; // the source object is also a kind of locker for the current object // since the listeners could dispose the object while being notified @@ -212,10 +209,7 @@ void SAL_CALL OInputCompStream::dispose( ) { ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) - { - SAL_INFO("package.xstor", "Disposed!"); - throw lang::DisposedException(); - } + return; if ( m_pInterfaceContainer ) { diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index f94a9fbdf9b5..6e22a853c18f 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1792,10 +1792,7 @@ OStorage::~OStorage() void OStorage::InternalDispose( bool bNotifyImpl ) { if ( !m_pImpl ) - { - SAL_INFO("package.xstor", THROW_WHERE "Disposed!"); - throw lang::DisposedException( THROW_WHERE ); - } + return; // the source object is also a kind of locker for the current object // since the listeners could dispose the object while being notified @@ -1803,10 +1800,7 @@ void OStorage::InternalDispose( bool bNotifyImpl ) m_aListenersContainer.disposeAndClear( aSource ); if ( !m_pImpl ) - { - SAL_INFO("package.xstor", THROW_WHERE "Disposed!"); - throw lang::DisposedException( THROW_WHERE ); - } + return; m_pImpl->m_nModifiedListenerCount = 0; |