From 6676d32077d74ec03dfe736c081e41b4b2059c5c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 24 Apr 2018 15:23:22 +0200 Subject: loplugin:useuniqueptr in Executor Change-Id: I3b21b4438f5762aa9960a121ba5826f47d6e9c68 Reviewed-on: https://gerrit.libreoffice.org/53603 Tested-by: Jenkins Reviewed-by: Noel Grandin --- drawinglayer/source/primitive2d/sceneprimitive2d.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 46e25920c769..35024d9bc684 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -386,16 +386,16 @@ namespace drawinglayer class Executor : public comphelper::ThreadTask { private: - processor3d::ZBufferProcessor3D* mpZBufferProcessor3D; + std::unique_ptr mpZBufferProcessor3D; const primitive3d::Primitive3DContainer& mrChildren3D; public: explicit Executor( std::shared_ptr const & rTag, - processor3d::ZBufferProcessor3D* pZBufferProcessor3D, + std::unique_ptr pZBufferProcessor3D, const primitive3d::Primitive3DContainer& rChildren3D) : comphelper::ThreadTask(rTag), - mpZBufferProcessor3D(pZBufferProcessor3D), + mpZBufferProcessor3D(std::move(pZBufferProcessor3D)), mrChildren3D(rChildren3D) { } @@ -404,7 +404,7 @@ namespace drawinglayer { mpZBufferProcessor3D->process(mrChildren3D); mpZBufferProcessor3D->finish(); - delete mpZBufferProcessor3D; + mpZBufferProcessor3D.reset(); } }; @@ -413,7 +413,7 @@ namespace drawinglayer for(sal_Int32 a(0); a < nThreadCount; a++) { - processor3d::ZBufferProcessor3D* pNewZBufferProcessor3D = new processor3d::ZBufferProcessor3D( + std::unique_ptr pNewZBufferProcessor3D(new processor3d::ZBufferProcessor3D( aViewInformation3D, getSdrSceneAttribute(), getSdrLightingAttribute(), @@ -423,8 +423,8 @@ namespace drawinglayer fFullViewSizeY, aBZPixelRaster, nLinesPerThread * a, - a + 1 == nThreadCount ? aBZPixelRaster.getHeight() : nLinesPerThread * (a + 1)); - Executor* pExecutor = new Executor(aTag, pNewZBufferProcessor3D, getChildren3D()); + a + 1 == nThreadCount ? aBZPixelRaster.getHeight() : nLinesPerThread * (a + 1))); + Executor* pExecutor = new Executor(aTag, std::move(pNewZBufferProcessor3D), getChildren3D()); rThreadPool.pushTask(pExecutor); } -- cgit