sc/inc/compiler.hxx              |    2 +-
 sc/source/core/tool/compiler.cxx |    8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 65747afbb644607c0d2a1fbf354a1a080292b285
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Tue Aug 23 15:40:09 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Tue Aug 23 22:09:48 2022 +0200

    Make static ScCompiler::GetCharClassLocalized() public as well
    
    ... and mutex guard it.
    
    Change-Id: Ief9c6deaf7974ac43c7ae439a0fb73c29eced283
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138733
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 5f6c521d11cf..965232485049 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -378,8 +378,8 @@ private:
 
     bool HasPossibleNamedRangeConflict(SCTAB nTab) const;
 
-    static const CharClass* GetCharClassLocalized();
 public:
+    static const CharClass* GetCharClassLocalized();
     static const CharClass* GetCharClassEnglish();
 
 public:
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index d4ee9a19fd14..ecd1dfed63f6 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -242,8 +242,12 @@ const CharClass* ScCompiler::GetCharClassLocalized()
     {
         // Switching UI language requires restart; if not, we would have to
         // keep track of that.
-        pCharClassLocalized = new CharClass(
-                ::comphelper::getProcessComponentContext(), 
Application::GetSettings().GetUILanguageTag());
+        osl::MutexGuard aGuard(maMutex);
+        if (!pCharClassLocalized)
+        {
+            pCharClassLocalized = new CharClass( 
::comphelper::getProcessComponentContext(),
+                    Application::GetSettings().GetUILanguageTag());
+        }
     }
     return pCharClassLocalized;
 }

Reply via email to