diff options
-rw-r--r-- | svgio/inc/svgpolynode.hxx | 10 | ||||
-rw-r--r-- | svgio/source/svgreader/svgpolynode.cxx | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/svgio/inc/svgpolynode.hxx b/svgio/inc/svgpolynode.hxx index 5a867fdb5e85..5e3e27d78888 100644 --- a/svgio/inc/svgpolynode.hxx +++ b/svgio/inc/svgpolynode.hxx @@ -35,8 +35,8 @@ namespace svgio SvgStyleAttributes maSvgStyleAttributes; /// variable scan values, dependent of given XAttributeList - basegfx::B2DPolygon* mpPolygon; - basegfx::B2DHomMatrix* mpaTransform; + std::unique_ptr<basegfx::B2DPolygon> mpPolygon; + std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform; bool mbIsPolyline : 1; // true = polyline, false = polygon @@ -52,11 +52,11 @@ namespace svgio virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// Polygon content, set if found in current context - void setPolygon(const basegfx::B2DPolygon* pPolygon) { if(mpPolygon) delete mpPolygon; mpPolygon = nullptr; if(pPolygon) mpPolygon = new basegfx::B2DPolygon(*pPolygon); } + void setPolygon(const basegfx::B2DPolygon* pPolygon) { mpPolygon.reset(); if(pPolygon) mpPolygon.reset(new basegfx::B2DPolygon(*pPolygon)); } /// transform content, set if found in current context - const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } - void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } + const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); } + void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset(new basegfx::B2DHomMatrix(*pMatrix)); } }; } // end of namespace svgreader } // end of namespace svgio diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx index 5de5fc87cc0d..14792a838678 100644 --- a/svgio/source/svgreader/svgpolynode.cxx +++ b/svgio/source/svgreader/svgpolynode.cxx @@ -40,8 +40,6 @@ namespace svgio SvgPolyNode::~SvgPolyNode() { - delete mpaTransform; - delete mpPolygon; } const SvgStyleAttributes* SvgPolyNode::getSvgStyleAttributes() const |