include/oox/helper/propertymap.hxx  |    5 ++---
 include/oox/token/propertynames.hxx |   18 +++---------------
 oox/source/helper/propertymap.cxx   |    4 ++--
 oox/source/token/propertynames.cxx  |    9 +++++----
 4 files changed, 12 insertions(+), 24 deletions(-)

New commits:
commit a75324ccabcf09c0f1bc7a1a43256aa37f0da751
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Nov 7 18:45:58 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Nov 8 07:43:09 2021 +0100

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

diff --git a/include/oox/helper/propertymap.hxx 
b/include/oox/helper/propertymap.hxx
index 85635f314d5e..3e48c9817fd1 100644
--- a/include/oox/helper/propertymap.hxx
+++ b/include/oox/helper/propertymap.hxx
@@ -22,6 +22,7 @@
 
 #include <map>
 #include <utility>
+#include <vector>
 
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Reference.hxx>
@@ -37,8 +38,6 @@ namespace com::sun::star::beans {
 
 namespace oox {
 
-struct PropertyNameVector;
-
 
 typedef ::std::map< OUString, css::uno::Any > PropertyNameMap;
 
@@ -114,7 +113,7 @@ public:
   static void dumpData( const css::uno::Reference<css::beans::XPropertySet>& 
rXPropSet);
 #endif
 private:
-    const PropertyNameVector* mpPropNames;
+    const std::vector<OUString>* mpPropNames;
 
 protected:
     std::map< sal_Int32, css::uno::Any > maProperties;
diff --git a/include/oox/token/propertynames.hxx 
b/include/oox/token/propertynames.hxx
index 84077359e1fe..91e07cbdd33b 100644
--- a/include/oox/token/propertynames.hxx
+++ b/include/oox/token/propertynames.hxx
@@ -16,30 +16,18 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-
-#ifndef INCLUDED_OOX_TOKEN_PROPERTYNAMES_HXX
-#define INCLUDED_OOX_TOKEN_PROPERTYNAMES_HXX
+#pragma once
 
 #include <vector>
 
-#include <rtl/instance.hxx>
 #include <rtl/ustring.hxx>
 
 namespace oox
 {
 /** A vector that contains all predefined property names used in the filters. 
*/
-struct PropertyNameVector : public ::std::vector<OUString>
-{
-    PropertyNameVector();
-};
-
-/** Thread-save singleton of a vector of all supported property names. */
-struct StaticPropertyNameVector : public ::rtl::Static<PropertyNameVector, 
StaticPropertyNameVector>
-{
-};
+/** Thread-safe singleton of a vector of all supported property names. */
+const std::vector<OUString>& GetPropertyNameVector();
 
 } // namespace oox
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/helper/propertymap.cxx 
b/oox/source/helper/propertymap.cxx
index afb6ef6ff6f6..83495dc879b1 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -180,7 +180,7 @@ sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( 
const OUString& rProper
 } // namespace
 
 PropertyMap::PropertyMap() :
-    mpPropNames( &StaticPropertyNameVector::get() ) // pointer instead 
reference to get compiler generated copy c'tor and operator=
+    mpPropNames( &GetPropertyNameVector() ) // pointer instead reference to 
get compiler generated copy c'tor and operator=
 {
 }
 
@@ -221,7 +221,7 @@ void PropertyMap::assignUsed( const PropertyMap& rPropMap )
 const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
 {
     OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), 
"PropertyMap::getPropertyName - invalid property identifier" );
-    return StaticPropertyNameVector::get()[ nPropId ];
+    return GetPropertyNameVector()[ nPropId ];
 }
 
 void PropertyMap::assignAll( const PropertyMap& rPropMap )
diff --git a/oox/source/token/propertynames.cxx 
b/oox/source/token/propertynames.cxx
index b7c5e544143c..eadf0d5d4d7a 100644
--- a/oox/source/token/propertynames.cxx
+++ b/oox/source/token/propertynames.cxx
@@ -21,12 +21,13 @@
 
 namespace oox
 {
-PropertyNameVector::PropertyNameVector()
-    : ::std::vector<OUString>{
+const std::vector<OUString>& GetPropertyNameVector()
+{
+    static const std::vector<OUString> NAMES{
 // include auto-generated C array with property names as C strings
 #include <propertynames.inc>
-    }
-{
+    };
+    return NAMES;
 }
 
 } // namespace oox

Reply via email to