From bf2048b1d242c6d5b242f18903612cedf8eaef8e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 11 Nov 2021 20:59:11 +0200 Subject: 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 --- oox/source/core/fastparser.cxx | 2 +- oox/source/core/xmlfilterbase.cxx | 2 +- oox/source/token/namespacemap.cxx | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) (limited to '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 }; } + +/** 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: */ -- cgit