[Libreoffice-commits] core.git: 2 commits - drawinglayer/source svtools/source

Noel Grandin noel.grandin at collabora.co.uk
Sun Apr 29 16:22:23 UTC 2018


 drawinglayer/source/primitive2d/sceneprimitive2d.cxx |   14 +++++++-------
 svtools/source/table/tablecontrol_impl.cxx           |    9 ++++-----
 svtools/source/table/tablecontrol_impl.hxx           |    4 ++--
 3 files changed, 13 insertions(+), 14 deletions(-)

New commits:
commit 6676d32077d74ec03dfe736c081e41b4b2059c5c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Apr 24 15:23:22 2018 +0200

    loplugin:useuniqueptr in Executor
    
    Change-Id: I3b21b4438f5762aa9960a121ba5826f47d6e9c68
    Reviewed-on: https://gerrit.libreoffice.org/53603
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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<processor3d::ZBufferProcessor3D> mpZBufferProcessor3D;
                             const primitive3d::Primitive3DContainer&    mrChildren3D;
 
                         public:
                             explicit Executor(
                                 std::shared_ptr<comphelper::ThreadTaskTag> const & rTag,
-                                processor3d::ZBufferProcessor3D* pZBufferProcessor3D,
+                                std::unique_ptr<processor3d::ZBufferProcessor3D> 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<processor3d::ZBufferProcessor3D> 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);
                         }
 
commit 9a2f5100711232da048f82c80f65913be32ba831
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Apr 24 15:12:19 2018 +0200

    loplugin:useuniqueptr in TableControl_Impl
    
    Change-Id: Ida89f2a72395e0a07d57100fda10fa0f739d9eef
    Reviewed-on: https://gerrit.libreoffice.org/53602
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 8c493e12c787..99428e8b1317 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -230,14 +230,13 @@ namespace svt { namespace table
         ,m_pVScroll             ( nullptr                          )
         ,m_pHScroll             ( nullptr                          )
         ,m_pScrollCorner        ( nullptr                          )
-        ,m_pSelEngine           (                               )
         ,m_aSelectedRows        (                               )
         ,m_pTableFunctionSet    ( new TableFunctionSet( this  ) )
         ,m_nAnchor              ( -1                            )
         ,m_bUpdatingColWidths   ( false                         )
         ,m_pAccessibleTable     ( nullptr                          )
     {
-        m_pSelEngine = new SelectionEngine( m_pDataWindow.get(), m_pTableFunctionSet );
+        m_pSelEngine.reset( new SelectionEngine( m_pDataWindow.get(), m_pTableFunctionSet.get() ) );
         m_pSelEngine->SetSelectionMode(SelectionMode::Single);
         m_pDataWindow->SetPosPixel( Point( 0, 0 ) );
         m_pDataWindow->Show();
@@ -249,8 +248,8 @@ namespace svt { namespace table
         m_pHScroll.disposeAndClear();
         m_pScrollCorner.disposeAndClear();
         m_pDataWindow.disposeAndClear();
-        DELETEZ( m_pTableFunctionSet );
-        DELETEZ( m_pSelEngine );
+        m_pTableFunctionSet.reset();
+        m_pSelEngine.reset();
     }
 
     void TableControl_Impl::setModel( const PTableModel& _pModel )
@@ -2147,7 +2146,7 @@ namespace svt { namespace table
 
     SelectionEngine* TableControl_Impl::getSelEngine()
     {
-        return m_pSelEngine;
+        return m_pSelEngine.get();
     }
 
     bool TableControl_Impl::isRowSelected( RowPos i_row ) const
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index a679bf646b46..51050748176c 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -121,11 +121,11 @@ namespace svt { namespace table
         VclPtr<ScrollBar>       m_pHScroll;
         VclPtr<ScrollBarBox>    m_pScrollCorner;
         //selection engine - for determining selection range, e.g. single, multiple
-        SelectionEngine*        m_pSelEngine;
+        std::unique_ptr<SelectionEngine> m_pSelEngine;
         //vector which contains the selected rows
         std::vector<RowPos>     m_aSelectedRows;
         //part of selection engine
-        TableFunctionSet*       m_pTableFunctionSet;
+        std::unique_ptr<TableFunctionSet> m_pTableFunctionSet;
         //part of selection engine
         RowPos                  m_nAnchor;
         bool                    m_bUpdatingColWidths;


More information about the Libreoffice-commits mailing list