diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-11 12:42:59 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-11 16:47:54 +0100 |
commit | 20b349052099aa1ecc00276e484cb84525c4931d (patch) | |
tree | 39301e37163918512e11dc00d3bceeebfa716b25 /tools/source/generic/poly.cxx | |
parent | 42c59d7c8fd1373e62fd0131852e9a631efd387a (diff) |
ofz#4592 Direct-leak
regression from
commit 225115af05cba9a603130914b49c5b28ed451108
Date: Fri Sep 15 09:17:17 2017 +0200
tdf#62525 tools: use cow_wrapper class for Polygon
Change-Id: Ibd9173bfb005f8a30317d95adea4e5fb25f1df1d
Reviewed-on: https://gerrit.libreoffice.org/46229
Reviewed-by: Andreas Brandner <Andreas.Brandner@cib.de>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'tools/source/generic/poly.cxx')
-rw-r--r-- | tools/source/generic/poly.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 664428426352..d735be9f91eb 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -709,11 +709,11 @@ protected: class ImplPolygonPointFilter : public ImplPointFilter { - std::unique_ptr<ImplPolygon> mxPoly; - sal_uInt16 mnSize; + ImplPolygon maPoly; + sal_uInt16 mnSize; public: explicit ImplPolygonPointFilter(sal_uInt16 nDestSize) - : mxPoly(new ImplPolygon(nDestSize)) + : maPoly(nDestSize) , mnSize(0) { } @@ -725,24 +725,24 @@ public: virtual void LastPoint() override; virtual void Input( const Point& rPoint ) override; - ImplPolygon* release() { return mxPoly.release(); } + ImplPolygon& get() { return maPoly; } }; void ImplPolygonPointFilter::Input( const Point& rPoint ) { - if ( !mnSize || (rPoint != mxPoly->mpPointAry[mnSize-1]) ) + if ( !mnSize || (rPoint != maPoly.mpPointAry[mnSize-1]) ) { mnSize++; - if ( mnSize > mxPoly->mnPoints ) - mxPoly->ImplSetSize( mnSize ); - mxPoly->mpPointAry[mnSize-1] = rPoint; + if ( mnSize > maPoly.mnPoints ) + maPoly.ImplSetSize( mnSize ); + maPoly.mpPointAry[mnSize-1] = rPoint; } } void ImplPolygonPointFilter::LastPoint() { - if ( mnSize < mxPoly->mnPoints ) - mxPoly->ImplSetSize( mnSize ); + if ( mnSize < maPoly.mnPoints ) + maPoly.ImplSetSize( mnSize ); }; class ImplEdgePointFilter : public ImplPointFilter @@ -1494,7 +1494,7 @@ void Polygon::Clip( const tools::Rectangle& rRect ) else aPolygon.LastPoint(); - mpImplPolygon = ImplType(*aPolygon.release()); + mpImplPolygon = ImplType(aPolygon.get()); } tools::Rectangle Polygon::GetBoundRect() const |