diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-14 09:41:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-14 09:45:31 +0100 |
commit | 8960dae3a24f5dd2712f1fe74de0c3b22552b12b (patch) | |
tree | 6b2d56915eddf3eb07d3a401be5365c90f946e1b /toolkit/source | |
parent | b32e46fbc3b536c1f56fe5d3714772ad673542a3 (diff) |
no need to hold OInterfaceContainerHelper4 by unique_ptr
when empty, it is only a single pointer big anyway
Change-Id: I3e45dd705c4bef3799435617db1a4192d62860e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128403
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit/source')
-rw-r--r-- | toolkit/source/hatchwindow/documentcloser.cxx | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/toolkit/source/hatchwindow/documentcloser.cxx b/toolkit/source/hatchwindow/documentcloser.cxx index 10cb6b37ecd6..16df8536f5f1 100644 --- a/toolkit/source/hatchwindow/documentcloser.cxx +++ b/toolkit/source/hatchwindow/documentcloser.cxx @@ -46,7 +46,7 @@ class ODocumentCloser : public ::cppu::WeakImplHelper< css::lang::XComponent, { std::mutex m_aMutex; css::uno::Reference< css::frame::XFrame > m_xFrame; - std::unique_ptr<::comphelper::OInterfaceContainerHelper4<lang::XEventListener>> m_pListenersContainer; // list of listeners + ::comphelper::OInterfaceContainerHelper4<lang::XEventListener> m_aListenersContainer; // list of listeners bool m_bDisposed; @@ -170,8 +170,7 @@ void SAL_CALL ODocumentCloser::dispose() throw lang::DisposedException(); lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) ); - if ( m_pListenersContainer ) - m_pListenersContainer->disposeAndClear( aGuard, aSource ); + m_aListenersContainer.disposeAndClear( aGuard, aSource ); // TODO: trigger a main thread execution to close the frame if ( m_xFrame.is() ) @@ -191,18 +190,14 @@ void SAL_CALL ODocumentCloser::addEventListener( const uno::Reference< lang::XEv if ( m_bDisposed ) throw lang::DisposedException(); // TODO - if ( !m_pListenersContainer ) - m_pListenersContainer.reset( new ::comphelper::OInterfaceContainerHelper4<lang::XEventListener>() ); - - m_pListenersContainer->addInterface( xListener ); + m_aListenersContainer.addInterface( xListener ); } void SAL_CALL ODocumentCloser::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) { std::unique_lock aGuard( m_aMutex ); - if ( m_pListenersContainer ) - m_pListenersContainer->removeInterface( xListener ); + m_aListenersContainer.removeInterface( xListener ); } // XServiceInfo |