i18npool/source/localedata/localedata.cxx               |   12 +++++++-----
 i18npool/source/transliteration/transliterationImpl.cxx |    5 ++---
 2 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 8b98f44b9643bdd873919185a617f530c04203e1
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Wed Nov 10 18:09:11 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Nov 11 15:49:33 2021 +0100

    rtl::Static to thread-safe static
    
    Change-Id: I98909614d4a8d4317867036678c7202e28dcf285
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125001
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/i18npool/source/localedata/localedata.cxx 
b/i18npool/source/localedata/localedata.cxx
index 5e8f1dee2f79..4caa7a05176a 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -31,7 +31,6 @@
 #include <i18nlangtag/languagetag.hxx>
 #include <sal/log.hxx>
 #include <osl/diagnose.h>
-#include <rtl/instance.hxx>
 #include <sal/macros.h>
 
 namespace com::sun::star::uno { class XComponentContext; }
@@ -505,8 +504,11 @@ private:
 // locking pattern correctly.
 // usage:  lcl_LookupTableHelper & rLookupTable = lcl_LookupTableStatic::get();
 // retrieves the singleton lookup table instance
-struct lcl_LookupTableStatic : public ::rtl::Static< lcl_LookupTableHelper, 
lcl_LookupTableStatic >
-{};
+lcl_LookupTableHelper& lcl_LookupTableStatic()
+{
+    static lcl_LookupTableHelper SINGLETON;
+    return SINGLETON;
+}
 
 lcl_LookupTableHelper::lcl_LookupTableHelper()
 {
@@ -1439,7 +1441,7 @@ LocaleDataImpl::getOutlineNumberingLevels( const 
lang::Locale& rLocale )
 
 oslGenericFunction LocaleDataImpl::getFunctionSymbol( const Locale& rLocale, 
const char* pFunction )
 {
-    lcl_LookupTableHelper & rLookupTable = lcl_LookupTableStatic::get();
+    lcl_LookupTableHelper & rLookupTable = lcl_LookupTableStatic();
 
     if (cachedItem && cachedItem->equals(rLocale))
     {
@@ -1496,7 +1498,7 @@ LocaleDataImpl::getAllInstalledLocaleNames()
         // Check if the locale is really available and not just in the table,
         // don't allow fall backs.
         std::unique_ptr<LocaleDataLookupTableItem> pCachedItem;
-        if (lcl_LookupTableStatic::get().getFunctionSymbolByName( name, 
"getLocaleItem", &pCachedItem )) {
+        if (lcl_LookupTableStatic().getFunctionSymbolByName( name, 
"getLocaleItem", &pCachedItem )) {
             if( pCachedItem )
                 cachedItem = std::move( pCachedItem );
             seqRange[nInstalled++] = LanguageTag::convertToLocale( 
name.replace( cUnder, cHyphen), false);
diff --git a/i18npool/source/transliteration/transliterationImpl.cxx 
b/i18npool/source/transliteration/transliterationImpl.cxx
index 54305126c640..09e791c33e71 100644
--- a/i18npool/source/transliteration/transliterationImpl.cxx
+++ b/i18npool/source/transliteration/transliterationImpl.cxx
@@ -27,7 +27,6 @@
 
 #include <comphelper/sequence.hxx>
 #include <cppuhelper/supportsservice.hxx>
-#include <rtl/instance.hxx>
 #include <rtl/ustring.hxx>
 
 #include <algorithm>
@@ -582,13 +581,13 @@ namespace
         OUString Name;
         css::uno::Reference< css::i18n::XExtendedTransliteration > Body;
     };
-    class theTransBodyMutex : public rtl::Static<osl::Mutex, 
theTransBodyMutex> {};
 }
 
 void TransliterationImpl::loadBody( OUString const &implName, 
Reference<XExtendedTransliteration>& body )
 {
     assert(!implName.isEmpty());
-    ::osl::MutexGuard guard(theTransBodyMutex::get());
+    static osl::Mutex transBodyMutex;
+    ::osl::MutexGuard guard(transBodyMutex);
     static TransBody lastTransBody;
     if (implName != lastTransBody.Name)
     {

Reply via email to