summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-05-07 14:09:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-08 12:34:40 +0200
commitdf63d1aa9ca0676e3df7b68dc8dc99246aa44240 (patch)
tree3dcbbdd7f6fe6f814c275ad5ff5e772ed4f04e5f
parente92536bac2545d7f2722fc2529d8c7a8ff7c85d8 (diff)
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.grandin@collabora.co.uk>
-rw-r--r--framework/inc/uielement/toolbarmanager.hxx7
-rw-r--r--framework/source/uielement/toolbarmanager.cxx16
2 files changed, 13 insertions, 10 deletions
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