framework/inc/uielement/uicommanddescription.hxx | 8 +++----- framework/source/uielement/uicommanddescription.cxx | 14 ++++++-------- 2 files changed, 9 insertions(+), 13 deletions(-)
New commits: commit a839a6afada46b44095be184548f6fa75d80e961 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Dec 24 20:46:01 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Dec 26 08:23:14 2021 +0100 use comphelper::WeakComponentImplHelper in UICommandDescription Change-Id: I042c9761c60d3b1c39950cfede80958edf2d84c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127461 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/inc/uielement/uicommanddescription.hxx b/framework/inc/uielement/uicommanddescription.hxx index 146b4f42db3a..aeeb1f9aa216 100644 --- a/framework/inc/uielement/uicommanddescription.hxx +++ b/framework/inc/uielement/uicommanddescription.hxx @@ -26,19 +26,17 @@ #include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/basemutex.hxx> -#include <cppuhelper/compbase.hxx> +#include <comphelper/compbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <rtl/ustring.hxx> #include <i18nlangtag/languagetag.hxx> namespace framework { -typedef ::cppu::WeakComponentImplHelper< css::lang::XServiceInfo, +typedef comphelper::WeakComponentImplHelper< css::lang::XServiceInfo, css::container::XNameAccess > UICommandDescription_BASE; -class UICommandDescription : private cppu::BaseMutex, - public UICommandDescription_BASE +class UICommandDescription : public UICommandDescription_BASE { public: UICommandDescription( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index 682b482766fc..9f81afced1a7 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -565,8 +565,7 @@ void UICommandDescription::ensureGenericUICommandsForLanguage(const LanguageTag& } UICommandDescription::UICommandDescription(const Reference< XComponentContext >& rxContext) - : UICommandDescription_BASE(m_aMutex) - , m_aPrivateResourceURL(PRIVATE_RESOURCE_URL) + : m_aPrivateResourceURL(PRIVATE_RESOURCE_URL) , m_xContext(rxContext) { SvtSysLocale aSysLocale; @@ -584,14 +583,13 @@ UICommandDescription::UICommandDescription(const Reference< XComponentContext >& } UICommandDescription::UICommandDescription(const Reference< XComponentContext >& rxContext, bool) - : UICommandDescription_BASE(m_aMutex) - , m_xContext(rxContext) + : m_xContext(rxContext) { } UICommandDescription::~UICommandDescription() { - osl::MutexGuard g(rBHelper.rMutex); + std::unique_lock g(m_aMutex); m_aModuleToCommandFileMap.clear(); m_aUICommandsHashMap.clear(); m_xGenericUICommands.clear(); @@ -637,7 +635,7 @@ Any SAL_CALL UICommandDescription::getByName( const OUString& aName ) const LanguageTag& rCurrentLanguage = aSysLocale.GetUILanguageTag(); Any a; - osl::MutexGuard g(rBHelper.rMutex); + std::unique_lock g(m_aMutex); ModuleToCommandFileMap::const_iterator pM2CIter = m_aModuleToCommandFileMap.find( aName ); if ( pM2CIter != m_aModuleToCommandFileMap.end() ) @@ -682,14 +680,14 @@ Any SAL_CALL UICommandDescription::getByName( const OUString& aName ) Sequence< OUString > SAL_CALL UICommandDescription::getElementNames() { - osl::MutexGuard g(rBHelper.rMutex); + std::unique_lock g(m_aMutex); return comphelper::mapKeysToSequence( m_aModuleToCommandFileMap ); } sal_Bool SAL_CALL UICommandDescription::hasByName( const OUString& aName ) { - osl::MutexGuard g(rBHelper.rMutex); + std::unique_lock g(m_aMutex); ModuleToCommandFileMap::const_iterator pIter = m_aModuleToCommandFileMap.find( aName ); return ( pIter != m_aModuleToCommandFileMap.end() );