[Libreoffice-commits] core.git: framework/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 18 14:52:43 UTC 2021
framework/source/uiconfiguration/uicategorydescription.cxx | 3 ++-
framework/source/uielement/uicommanddescription.cxx | 10 +++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 7d1e91f43f8f5963475dcac954e47b35efb00e20
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jun 18 13:06:53 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jun 18 16:51:59 2021 +0200
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 at redhat.com>
diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx
index 1e747fa13255..620384fadb14 100644
--- a/framework/source/uiconfiguration/uicategorydescription.cxx
+++ b/framework/source/uiconfiguration/uicategorydescription.cxx
@@ -365,7 +365,8 @@ public:
UICategoryDescription::UICategoryDescription( const Reference< XComponentContext >& rxContext ) :
UICommandDescription(rxContext,true)
{
- const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ SvtSysLocale aSysLocale;
+ const LanguageTag& rCurrentLanguage = aSysLocale.GetUILanguageTag();
Reference< XNameAccess > xEmpty;
OUString aGenericCategories( "GenericCategories" );
m_xGenericUICommands[rCurrentLanguage] = new ConfigurationAccess_UICategory( aGenericCategories, xEmpty, rxContext );
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);
More information about the Libreoffice-commits
mailing list