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

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 26 09:55:23 UTC 2018


 sc/source/core/inc/adiasync.hxx  |    2 +-
 sc/source/core/tool/adiasync.cxx |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 7e1fbb3cdbe905d0b21fd0e5738c1513af252b73
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Mar 23 11:59:10 2018 +0200

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

diff --git a/sc/source/core/inc/adiasync.hxx b/sc/source/core/inc/adiasync.hxx
index b0fa50393415..91b65311b71e 100644
--- a/sc/source/core/inc/adiasync.hxx
+++ b/sc/source/core/inc/adiasync.hxx
@@ -40,7 +40,7 @@ private:
         double      nVal;               // current value
         OUString*   pStr;
     };
-    ScAddInDocs*    pDocs;              // List of using documents
+    std::unique_ptr<ScAddInDocs> pDocs; // List of using documents
     LegacyFuncData* mpFuncData;         // Pointer to data in collection
     sal_uLong       nHandle;            // is casted from double to sal_uLong
     ParamType       meType;             // result of type PTR_DOUBLE or PTR_STRING
diff --git a/sc/source/core/tool/adiasync.cxx b/sc/source/core/tool/adiasync.cxx
index 5f02238a7601..e7070603c8c2 100644
--- a/sc/source/core/tool/adiasync.cxx
+++ b/sc/source/core/tool/adiasync.cxx
@@ -48,7 +48,7 @@ ScAddInAsync::ScAddInAsync(sal_uLong nHandleP, LegacyFuncData* pFuncData, ScDocu
     meType(pFuncData->GetAsyncType()),
     bValid( false )
 {
-    pDocs = new ScAddInDocs;
+    pDocs.reset(new ScAddInDocs);
     pDocs->insert( pDoc );
     theAddInAsyncTbl.insert( this );
 }
@@ -59,7 +59,7 @@ ScAddInAsync::~ScAddInAsync()
     mpFuncData->Unadvice( static_cast<double>(nHandle) );
     if ( meType == ParamType::PTR_STRING && pStr )      // include type comparison because of union
         delete pStr;
-    delete pDocs;
+    pDocs.reset();
 }
 
 ScAddInAsync* ScAddInAsync::Get( sal_uLong nHandleP )
@@ -123,7 +123,7 @@ void ScAddInAsync::RemoveDocument( ScDocument* pDocumentP )
         for( ScAddInAsyncs::reverse_iterator iter1 = theAddInAsyncTbl.rbegin(); iter1 != theAddInAsyncTbl.rend(); ++iter1 )
         {   // backwards because of pointer-movement in array
             ScAddInAsync* pAsync = *iter1;
-            ScAddInDocs* p = pAsync->pDocs;
+            ScAddInDocs* p = pAsync->pDocs.get();
             ScAddInDocs::iterator iter2 = p->find( pDocumentP );
             if( iter2 != p->end() )
             {


More information about the Libreoffice-commits mailing list