comphelper/source/property/genericpropertyset.cxx | 9 +------ cppuhelper/source/component_context.cxx | 28 ++++++++-------------- 2 files changed, 13 insertions(+), 24 deletions(-)
New commits: commit 64589ddc911ed7bcc334adecd46b472adfec15f2 Author: Noel Grandin <[email protected]> AuthorDate: Sat Dec 18 13:02:17 2021 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sun Dec 19 17:46:47 2021 +0100 use more cppu::BaseMutex Change-Id: I7ac096acfde05aa58a48fb76e895e880e27225d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127085 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/comphelper/source/property/genericpropertyset.cxx b/comphelper/source/property/genericpropertyset.cxx index 26f21e987e29..b9a8bf84af45 100644 --- a/comphelper/source/property/genericpropertyset.cxx +++ b/comphelper/source/property/genericpropertyset.cxx @@ -44,19 +44,14 @@ namespace comphelper { namespace { - struct IMPL_GenericPropertySet_MutexContainer - { - Mutex maMutex; - }; - class GenericPropertySet : public OWeakAggObject, public XServiceInfo, public XTypeProvider, - public PropertySetHelper, - private IMPL_GenericPropertySet_MutexContainer + public PropertySetHelper { private: std::map<OUString, Any> maAnyMap; + osl::Mutex maMutex; comphelper::OMultiTypeInterfaceContainerHelperVar3<XPropertyChangeListener, OUString> m_aListener; protected: diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx index 1aa3d33e5c35..440fe18cfa4d 100644 --- a/cppuhelper/source/component_context.cxx +++ b/cppuhelper/source/component_context.cxx @@ -27,6 +27,7 @@ #include <uno/lbnames.h> #include <uno/mapping.hxx> +#include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/component_context.hxx> #include <cppuhelper/implbase.hxx> @@ -113,15 +114,8 @@ void DisposingForwarder::disposing( lang::EventObject const & ) namespace { -struct MutexHolder -{ -protected: - Mutex m_mutex; -}; - - class ComponentContext - : private MutexHolder + : private cppu::BaseMutex , public WeakComponentImplHelper< XComponentContext, container::XNameContainer > { @@ -184,7 +178,7 @@ void ComponentContext::insertByName( /* lateInit_: */ name.startsWith( "/singletons/" ) && !element.hasValue() ); - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); std::pair<t_map::iterator, bool> insertion( m_map.emplace( name, entry ) ); if (! insertion.second) @@ -196,7 +190,7 @@ void ComponentContext::insertByName( void ComponentContext::removeByName( OUString const & name ) { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); t_map::iterator iFind( m_map.find( name ) ); if (iFind == m_map.end()) throw container::NoSuchElementException( @@ -211,7 +205,7 @@ void ComponentContext::removeByName( OUString const & name ) void ComponentContext::replaceByName( OUString const & name, Any const & element ) { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); t_map::iterator iFind( m_map.find( name ) ); if (iFind == m_map.end()) throw container::NoSuchElementException( @@ -240,14 +234,14 @@ Any ComponentContext::getByName( OUString const & name ) Sequence<OUString> ComponentContext::getElementNames() { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); return comphelper::mapKeysToSequence(m_map); } sal_Bool ComponentContext::hasByName( OUString const & name ) { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); return m_map.find( name ) != m_map.end(); } @@ -261,14 +255,14 @@ Type ComponentContext::getElementType() sal_Bool ComponentContext::hasElements() { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); return ! m_map.empty(); } Any ComponentContext::lookupMap( OUString const & rName ) { - ResettableMutexGuard guard( m_mutex ); + ResettableMutexGuard guard( m_aMutex ); t_map::iterator iFind( m_map.find( rName ) ); if (iFind == m_map.end()) return Any(); @@ -403,7 +397,7 @@ void ComponentContext::disposing() if (rEntry.lateInit) { // late init - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); if (rEntry.lateInit) { rEntry.value.clear(); // release factory @@ -464,7 +458,7 @@ void ComponentContext::disposing() ComponentContext::ComponentContext( ContextEntry_Init const * pEntries, sal_Int32 nEntries, Reference< XComponentContext > const & xDelegate ) - : WeakComponentImplHelper( m_mutex ), + : WeakComponentImplHelper( m_aMutex ), m_xDelegate( xDelegate ) { for ( sal_Int32 nPos = 0; nPos < nEntries; ++nPos )
