diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-06-18 13:06:53 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-06-18 16:51:59 +0200 |
commit | 7d1e91f43f8f5963475dcac954e47b35efb00e20 (patch) | |
tree | 08af90ad3d63b531072174b2d2ad2306259f9b2b /framework/source/uielement | |
parent | 53fa4f61820e3fa9a92c5874ea641b54fe564f02 (diff) |
hold SvtSysLocale for lifetime of returned GetUILanguageTag reference
Change-Id: I36b01e6b4827aceca95502386ab1abc4cf0baaea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117449
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'framework/source/uielement')
-rw-r--r-- | framework/source/uielement/uicommanddescription.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index ca9d929435f8..90051358f5be 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -574,7 +574,8 @@ UICommandDescription::UICommandDescription(const Reference< XComponentContext >& , m_aPrivateResourceURL(PRIVATE_RESOURCE_URL) , m_xContext(rxContext) { - const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag(); + SvtSysLocale aSysLocale; + const LanguageTag& rCurrentLanguage = aSysLocale.GetUILanguageTag(); ensureGenericUICommandsForLanguage(rCurrentLanguage); @@ -605,6 +606,8 @@ void UICommandDescription::impl_fillElements(const char* _pName) m_xModuleManager.set( ModuleManager::create( m_xContext ) ); const Sequence< OUString > aElementNames = m_xModuleManager->getElementNames(); + SvtSysLocale aSysLocale; + for ( OUString const & aModuleIdentifier : aElementNames ) { Sequence< PropertyValue > aSeq; @@ -624,7 +627,7 @@ void UICommandDescription::impl_fillElements(const char* _pName) m_aModuleToCommandFileMap.emplace( aModuleIdentifier, aCommandStr ); // Create second mapping Command File ==> commands instance - const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag(); + const LanguageTag& rCurrentLanguage = aSysLocale.GetUILanguageTag(); auto& rMap = m_aUICommandsHashMap[rCurrentLanguage]; UICommandsHashMap::iterator pIter = rMap.find( aCommandStr ); if ( pIter == rMap.end() ) @@ -635,7 +638,8 @@ void UICommandDescription::impl_fillElements(const char* _pName) Any SAL_CALL UICommandDescription::getByName( const OUString& aName ) { - const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag(); + SvtSysLocale aSysLocale; + const LanguageTag& rCurrentLanguage = aSysLocale.GetUILanguageTag(); Any a; osl::MutexGuard g(rBHelper.rMutex); |