include/oox/token/tokenmap.hxx                 |    4 +---
 oox/source/core/fasttokenhandler.cxx           |    2 +-
 oox/source/drawingml/customshapeproperties.cxx |    2 +-
 oox/source/mathml/importutils.cxx              |    2 +-
 oox/source/token/tokenmap.cxx                  |    6 ++++++
 5 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 39f4fd491ca5abaa8a01b75eb500bb82248ff4aa
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Nov 12 19:36:06 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Nov 13 15:59:32 2021 +0100

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

diff --git a/include/oox/token/tokenmap.hxx b/include/oox/token/tokenmap.hxx
index 60aeb8082001..db71c24c2371 100644
--- a/include/oox/token/tokenmap.hxx
+++ b/include/oox/token/tokenmap.hxx
@@ -28,7 +28,6 @@
 #include <com/sun/star/uno/Sequence.hxx>
 #include <oox/token/tokens.hxx>
 #include <oox/dllapi.h>
-#include <rtl/instance.hxx>
 #include <rtl/ustring.hxx>
 #include <sal/log.hxx>
 #include <sal/types.h>
@@ -87,8 +86,7 @@ private:
 };
 
 
-struct StaticTokenMap : public ::rtl::Static< TokenMap, StaticTokenMap > {};
-
+TokenMap& StaticTokenMap();
 
 } // namespace oox
 
diff --git a/oox/source/core/fasttokenhandler.cxx 
b/oox/source/core/fasttokenhandler.cxx
index a57be30e0c2c..398772df058f 100644
--- a/oox/source/core/fasttokenhandler.cxx
+++ b/oox/source/core/fasttokenhandler.cxx
@@ -30,7 +30,7 @@ namespace oox::core {
 using namespace ::com::sun::star::uno;
 
 FastTokenHandler::FastTokenHandler() :
-    mrTokenMap( StaticTokenMap::get() )
+    mrTokenMap( StaticTokenMap() )
 {
 }
 
diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index ac11d2d7eaa6..977afab04a6a 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -55,7 +55,7 @@ CustomShapeProperties::CustomShapeProperties()
 
 uno::Sequence< sal_Int8 > const & 
CustomShapeProperties::getShapePresetTypeName() const
 {
-    return StaticTokenMap::get().getUtf8TokenName( mnShapePresetType );
+    return StaticTokenMap().getUtf8TokenName( mnShapePresetType );
 }
 
 sal_Int32 CustomShapeProperties::SetCustomShapeGuideValue( std::vector< 
CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide )
diff --git a/oox/source/mathml/importutils.cxx 
b/oox/source/mathml/importutils.cxx
index 962528acba2a..16f527389924 100644
--- a/oox/source/mathml/importutils.cxx
+++ b/oox/source/mathml/importutils.cxx
@@ -51,7 +51,7 @@ AttributeListBuilder::AttributeListBuilder( const 
uno::Reference< xml::sax::XFas
 
 OString tokenToString( int token )
 {
-    uno::Sequence< sal_Int8 > const & aTokenNameSeq = 
StaticTokenMap::get().getUtf8TokenName( token & TOKEN_MASK );
+    uno::Sequence< sal_Int8 > const & aTokenNameSeq = 
StaticTokenMap().getUtf8TokenName( token & TOKEN_MASK );
     OString tokenname( reinterpret_cast< const char* >( 
aTokenNameSeq.getConstArray() ), aTokenNameSeq.getLength() );
     if( tokenname.isEmpty())
         tokenname = "???";
diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx
index 7cbba35009ae..1e51116192c6 100644
--- a/oox/source/token/tokenmap.cxx
+++ b/oox/source/token/tokenmap.cxx
@@ -87,6 +87,12 @@ sal_Int32 TokenMap::getTokenPerfectHash( const char *pStr, 
sal_Int32 nLength )
     return pToken ? pToken->nToken : XML_TOKEN_INVALID;
 }
 
+TokenMap& StaticTokenMap()
+{
+    static TokenMap SINGLETON;
+    return SINGLETON;
+}
+
 } // namespace oox
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to