framework/inc/uielement/toolbarmanager.hxx | 7 ++++--- framework/source/uielement/toolbarmanager.cxx | 16 +++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-)
New commits: commit df63d1aa9ca0676e3df7b68dc8dc99246aa44240 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sat May 7 14:09:51 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun May 8 12:34:40 2022 +0200 osl::Mutex->std::mutex in framework::ToolBarManager Change-Id: I6908dc61cbd6e6e4d11c52dfface1d863cd7e5c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133977 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index a12528415184..3ac9ef15012a 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -37,7 +37,7 @@ #include <rtl/ustring.hxx> #include <cppuhelper/implbase.hxx> -#include <comphelper/multicontainer2.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <tools/link.hxx> #include <vcl/weld.hxx> @@ -45,6 +45,7 @@ #include <vcl/timer.hxx> #include <vcl/toolbox.hxx> +#include <mutex> #include <unordered_map> class PopupMenu; @@ -228,8 +229,8 @@ class ToolBarManager final : public ToolbarManager_Base css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; css::uno::Reference< css::frame::XFrame > m_xFrame; ToolBarControllerMap m_aControllerMap; - osl::Mutex m_mutex; - comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener + std::mutex m_mutex; + comphelper::OInterfaceContainerHelper4<XEventListener> m_aListenerContainer; css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::frame::XUIControllerFactory > m_xToolbarControllerFactory; css::uno::Reference< css::ui::XImageManager > m_xModuleImageManager; diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 88bba421ff1c..4213271f2cf1 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -575,7 +575,6 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, m_pToolBar( pToolBar ), m_aResourceName( rResourceName ), m_xFrame( rFrame ), - m_aListenerContainer( m_mutex ), m_xContext( rxContext ), m_aAsyncUpdateControllersTimer( "framework::ToolBarManager m_aAsyncUpdateControllersTimer" ), m_sIconTheme( SvtMiscOptions().GetIconTheme() ) @@ -596,7 +595,6 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, m_pToolBar( nullptr ), m_aResourceName( rResourceName ), m_xFrame( rFrame ), - m_aListenerContainer( m_mutex ), m_xContext( rxContext ), m_aAsyncUpdateControllersTimer( "framework::ToolBarManager m_aAsyncUpdateControllersTimer" ), m_sIconTheme( SvtMiscOptions().GetIconTheme() ) @@ -844,9 +842,11 @@ void SAL_CALL ToolBarManager::dispose() { Reference< XComponent > xThis(this); - EventObject aEvent( xThis ); - m_aListenerContainer.disposeAndClear( aEvent ); - + { + EventObject aEvent( xThis ); + std::unique_lock aGuard(m_mutex); + m_aListenerContainer.disposeAndClear( aGuard, aEvent ); + } { SolarMutexGuard g; @@ -922,12 +922,14 @@ void SAL_CALL ToolBarManager::addEventListener( const Reference< XEventListener if ( m_bDisposed ) throw DisposedException(); - m_aListenerContainer.addInterface( cppu::UnoType<XEventListener>::get(), xListener ); + std::unique_lock aGuard(m_mutex); + m_aListenerContainer.addInterface( aGuard, xListener ); } void SAL_CALL ToolBarManager::removeEventListener( const Reference< XEventListener >& xListener ) { - m_aListenerContainer.removeInterface( cppu::UnoType<XEventListener>::get(), xListener ); + std::unique_lock aGuard(m_mutex); + m_aListenerContainer.removeInterface( aGuard, xListener ); } // XUIConfigurationListener