include/oox/token/namespacemap.hxx |    7 ++-----
 oox/source/core/fastparser.cxx     |    2 +-
 oox/source/core/xmlfilterbase.cxx  |    2 +-
 oox/source/token/namespacemap.cxx  |    7 +++++++
 4 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit bf2048b1d242c6d5b242f18903612cedf8eaef8e
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Nov 11 20:59:11 2021 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sat Nov 13 13:01:06 2021 +0100

    rtl::Static->thread-safe static in StaticNamespaceMap
    
    Change-Id: Iea6f7f96685e332407288af7ada36527acc83a8e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125119
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/include/oox/token/namespacemap.hxx 
b/include/oox/token/namespacemap.hxx
index 26e4fdce95f7..c02a39ba7bf8 100644
--- a/include/oox/token/namespacemap.hxx
+++ b/include/oox/token/namespacemap.hxx
@@ -22,7 +22,6 @@
 
 #include <map>
 
-#include <rtl/instance.hxx>
 #include <rtl/ustring.hxx>
 #include <sal/types.h>
 
@@ -40,10 +39,8 @@ struct NamespaceMap
     typedef std::map<sal_Int32, OUString>::const_iterator const_iterator;
 };
 
-/** Thread-save singleton of a map of all supported XML namespace URLs. */
-struct StaticNamespaceMap : public ::rtl::Static<NamespaceMap, 
StaticNamespaceMap>
-{
-};
+/** Thread-safe singleton of a map of all supported XML namespace URLs. */
+NamespaceMap& StaticNamespaceMap();
 
 } // namespace oox
 
diff --git a/oox/source/core/fastparser.cxx b/oox/source/core/fastparser.cxx
index 9524b1403a90..53e5eb78a849 100644
--- a/oox/source/core/fastparser.cxx
+++ b/oox/source/core/fastparser.cxx
@@ -62,7 +62,7 @@ InputStreamCloseGuard::~InputStreamCloseGuard()
 } // namespace
 
 FastParser::FastParser() :
-    mrNamespaceMap( StaticNamespaceMap::get() )
+    mrNamespaceMap( StaticNamespaceMap() )
 {
     // create a fast parser instance
     mxParser = new sax_fastparser::FastSaxParser;
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 6c7aaac65476..7a9728e88f32 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -188,7 +188,7 @@ struct XmlFilterBaseImpl
 constexpr OUStringLiteral gaBinSuffix( u".bin" );
 
 XmlFilterBaseImpl::XmlFilterBaseImpl() :
-    mrNamespaceMap(StaticNamespaceMap::get())
+    mrNamespaceMap(StaticNamespaceMap())
 {
     // register XML namespaces
     registerNamespaces(maFastParser);
diff --git a/oox/source/token/namespacemap.cxx 
b/oox/source/token/namespacemap.cxx
index 11e7c9f0e45f..1cfa48a1ca28 100644
--- a/oox/source/token/namespacemap.cxx
+++ b/oox/source/token/namespacemap.cxx
@@ -31,6 +31,13 @@ NamespaceMap::NamespaceMap()
 #include <namespaces-strictnames.inc>
     };
 }
+
+/** Thread-safe singleton of a map of all supported XML namespace URLs. */
+NamespaceMap& StaticNamespaceMap()
+{
+    static NamespaceMap SINGLETON;
+    return SINGLETON;
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to