diff options
Diffstat (limited to 'embeddedobj/source/msole/olecomponent.cxx')
-rw-r--r-- | embeddedobj/source/msole/olecomponent.cxx | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index 2fa50bd452e0..06f24c9b080c 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -460,9 +460,7 @@ OleComponent::~OleComponent() if ( m_pOleWrapClientSite || m_pImplAdviseSink || m_pInterfaceContainer || m_bOleInitialized ) { - ::osl::ClearableMutexGuard aGuard( m_aMutex ); - m_refCount++; - aGuard.clear(); + osl_atomic_increment(&m_refCount); try { Dispose(); } catch( const uno::Exception& ) {} @@ -1418,52 +1416,56 @@ void OleComponent::OnClose_Impl() void SAL_CALL OleComponent::close( sal_Bool bDeliverOwnership ) { - ::osl::ClearableMutexGuard aGuard( m_aMutex ); - if ( m_bDisposed ) - throw lang::DisposedException(); // TODO + uno::Reference< uno::XInterface > xSelfHold; + { + osl::MutexGuard aGuard(m_aMutex); + if (m_bDisposed) + throw lang::DisposedException(); // TODO - uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) ); - lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) ); + xSelfHold.set(static_cast<::cppu::OWeakObject*>(this)); + lang::EventObject aSource(static_cast<::cppu::OWeakObject*>(this)); - if ( m_pInterfaceContainer ) - { - ::cppu::OInterfaceContainerHelper* pContainer = - m_pInterfaceContainer->getContainer( cppu::UnoType<util::XCloseListener>::get()); - if ( pContainer != nullptr ) + if (m_pInterfaceContainer) { - ::cppu::OInterfaceIteratorHelper pIterator( *pContainer ); - while ( pIterator.hasMoreElements() ) + ::cppu::OInterfaceContainerHelper* pContainer + = m_pInterfaceContainer->getContainer(cppu::UnoType<util::XCloseListener>::get()); + if (pContainer != nullptr) { - try + ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + while (pIterator.hasMoreElements()) { - static_cast<util::XCloseListener*>( pIterator.next() )->queryClosing( aSource, bDeliverOwnership ); - } - catch( const uno::RuntimeException& ) - { - pIterator.remove(); + try + { + static_cast<util::XCloseListener*>(pIterator.next()) + ->queryClosing(aSource, bDeliverOwnership); + } + catch (const uno::RuntimeException&) + { + pIterator.remove(); + } } } - } - pContainer = m_pInterfaceContainer->getContainer( - cppu::UnoType<util::XCloseListener>::get()); - if ( pContainer != nullptr ) - { - ::cppu::OInterfaceIteratorHelper pCloseIterator( *pContainer ); - while ( pCloseIterator.hasMoreElements() ) + pContainer + = m_pInterfaceContainer->getContainer(cppu::UnoType<util::XCloseListener>::get()); + if (pContainer != nullptr) { - try + ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer); + while (pCloseIterator.hasMoreElements()) { - static_cast<util::XCloseListener*>( pCloseIterator.next() )->notifyClosing( aSource ); - } - catch( const uno::RuntimeException& ) - { - pCloseIterator.remove(); + try + { + static_cast<util::XCloseListener*>(pCloseIterator.next()) + ->notifyClosing(aSource); + } + catch (const uno::RuntimeException&) + { + pCloseIterator.remove(); + } } } } } - aGuard.clear(); Dispose(); } |