From 7458cb8d13b2893ccbfb648198319cc3a73d7e50 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 10 Sep 2022 19:25:04 +0200 Subject: no need to allocate this on the heap Change-Id: I33a85dfd8108c2131aa6d2a9b94d0b2c3d86bce8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139782 Tested-by: Jenkins Reviewed-by: Noel Grandin --- linguistic/source/misc.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'linguistic') diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index de2bc96860ee..dc4c17ce8430 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -64,10 +65,10 @@ osl::Mutex & GetLinguMutex() const LocaleDataWrapper & GetLocaleDataWrapper( LanguageType nLang ) { - static std::unique_ptr xLclDtaWrp; - if (!xLclDtaWrp || xLclDtaWrp->getLoadedLanguageTag().getLanguageType() != nLang) - xLclDtaWrp.reset(new LocaleDataWrapper(LanguageTag( nLang ))); - return *xLclDtaWrp; + static std::optional oLclDtaWrp; + if (!oLclDtaWrp || oLclDtaWrp->getLoadedLanguageTag().getLanguageType() != nLang) + oLclDtaWrp.emplace(LanguageTag( nLang )); + return *oLclDtaWrp; } LanguageType LinguLocaleToLanguage( const css::lang::Locale& rLocale ) -- cgit