summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-06-18 13:06:53 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-06-18 16:51:59 +0200
commit7d1e91f43f8f5963475dcac954e47b35efb00e20 (patch)
tree08af90ad3d63b531072174b2d2ad2306259f9b2b /framework
parent53fa4f61820e3fa9a92c5874ea641b54fe564f02 (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')
-rw-r--r--framework/source/uiconfiguration/uicategorydescription.cxx3
-rw-r--r--framework/source/uielement/uicommanddescription.cxx10
2 files changed, 9 insertions, 4 deletions
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);