basegfx/source/polygon/b2dpolypolygon.cxx  |    2 +-
 basegfx/source/tools/unopolypolygon.cxx    |    7 +------
 include/basegfx/polygon/b2dpolypolygon.hxx |    2 +-
 3 files changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 1aaf5d44dceecc13a3bc8e08c13d0b2ba278c462
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Jul 14 14:33:09 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Jul 14 19:11:22 2022 +0200

    make B2DPolyPolygon thread-safe
    
    which is cheaper than copying it when querying from UnoPolyPolygon
    
    Change-Id: If4661dfdff7e277d5ef25a8f0c937e549f8be9f1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137080
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx 
b/basegfx/source/polygon/b2dpolypolygon.cxx
index a283828f661c..ad24ffa0b87c 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -205,7 +205,7 @@ public:
     }
 };
 
-    static o3tl::cow_wrapper<ImplB2DPolyPolygon> DEFAULT;
+    static o3tl::cow_wrapper<ImplB2DPolyPolygon, 
o3tl::ThreadSafeRefCountingPolicy> DEFAULT;
 
     B2DPolyPolygon::B2DPolyPolygon() :
         mpPolyPolygon(DEFAULT) {}
diff --git a/basegfx/source/tools/unopolypolygon.cxx 
b/basegfx/source/tools/unopolypolygon.cxx
index 76341e6ea532..0c3b59abac9b 100644
--- a/basegfx/source/tools/unopolypolygon.cxx
+++ b/basegfx/source/tools/unopolypolygon.cxx
@@ -38,8 +38,6 @@ namespace basegfx::unotools
         maPolyPoly(std::move( aPolyPoly )),
         meFillRule( rendering::FillRule_EVEN_ODD )
     {
-        // or else races will haunt us.
-        maPolyPoly.makeUnique();
     }
 
     void SAL_CALL UnoPolyPolygon::addPolyPolygon(
@@ -440,10 +438,7 @@ namespace basegfx::unotools
     {
         std::unique_lock const guard( m_aMutex );
 
-        // detach result from us
-        B2DPolyPolygon aRet( maPolyPoly );
-        aRet.makeUnique();
-        return aRet;
+        return maPolyPoly;
     }
 
 }
diff --git a/include/basegfx/polygon/b2dpolypolygon.hxx 
b/include/basegfx/polygon/b2dpolypolygon.hxx
index 474c0cbdb40f..68f1b0d6a619 100644
--- a/include/basegfx/polygon/b2dpolypolygon.hxx
+++ b/include/basegfx/polygon/b2dpolypolygon.hxx
@@ -36,7 +36,7 @@ namespace basegfx
     class BASEGFX_DLLPUBLIC B2DPolyPolygon
     {
     private:
-        o3tl::cow_wrapper<ImplB2DPolyPolygon> mpPolyPolygon;
+        o3tl::cow_wrapper<ImplB2DPolyPolygon, 
o3tl::ThreadSafeRefCountingPolicy> mpPolyPolygon;
 
     public:
         B2DPolyPolygon();

Reply via email to