[Libreoffice-commits] core.git: sc/inc sc/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Jul 10 06:32:05 UTC 2018


 sc/inc/cellsuno.hxx              |    2 +-
 sc/source/ui/unoobj/cellsuno.cxx |    8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 02329510d45395422556ff2ac0a0e52892aecb77
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jul 9 16:04:37 2018 +0200

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

diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 9cc132541a83..f36ec2a92573 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -1150,7 +1150,7 @@ class ScCellFormatsEnumeration : public cppu::WeakImplHelper<
 private:
     ScDocShell*             pDocShell;
     SCTAB                   nTab;
-    ScAttrRectIterator*     pIter;
+    std::unique_ptr<ScAttrRectIterator> pIter;
     ScRange                 aNext;
     bool                    bAtEnd;
     bool                    bDirty;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index b8465626ab9c..9273ed844c47 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -9176,9 +9176,9 @@ ScCellFormatsEnumeration::ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScR
     OSL_ENSURE( rRange.aStart.Tab() == rRange.aEnd.Tab(),
                 "CellFormatsEnumeration: different tables" );
 
-    pIter = new ScAttrRectIterator( &rDoc, nTab,
+    pIter.reset( new ScAttrRectIterator( &rDoc, nTab,
                                     rRange.aStart.Col(), rRange.aStart.Row(),
-                                    rRange.aEnd.Col(), rRange.aEnd.Row() );
+                                    rRange.aEnd.Col(), rRange.aEnd.Row() ) );
     Advance_Impl();
 }
 
@@ -9188,7 +9188,6 @@ ScCellFormatsEnumeration::~ScCellFormatsEnumeration()
 
     if (pDocShell)
         pDocShell->GetDocument().RemoveUnoObject(*this);
-    delete pIter;
 }
 
 void ScCellFormatsEnumeration::Advance_Impl()
@@ -9240,8 +9239,7 @@ void ScCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
         if ( nId == SfxHintId::Dying )
         {
             pDocShell = nullptr;
-            delete pIter;
-            pIter = nullptr;
+            pIter.reset();
         }
         else if ( nId == SfxHintId::DataChanged )
         {


More information about the Libreoffice-commits mailing list