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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 29 09:13:00 UTC 2019


 sc/source/ui/unoobj/dapiuno.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit e7bd86b399e549ef51397e3ae46947d78852e9cc
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jan 29 08:46:22 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jan 29 10:12:35 2019 +0100

    use unique_ptr in ScDataPilotFieldObj
    
    Change-Id: I351999f92b83e156ffe62e02c851050d4621fe7e
    Reviewed-on: https://gerrit.libreoffice.org/67048
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 45200badbc83..b0158f954ece 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -2566,14 +2566,14 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons
             }
         }
 
-        ScDPSaveGroupDimension* pNewGroupDim = nullptr;
+        std::unique_ptr<ScDPSaveGroupDimension> pNewGroupDim;
         if ( !pGroupDimension )
         {
             // create a new group dimension
             sNewDim = pDimData->CreateGroupDimName( aBaseDimName, *pDPObj, false, nullptr );
-            pNewGroupDim = new ScDPSaveGroupDimension( aBaseDimName, sNewDim );
+            pNewGroupDim.reset(new ScDPSaveGroupDimension( aBaseDimName, sNewDim ));
 
-            pGroupDimension = pNewGroupDim;     // make changes to the new dim if none existed
+            pGroupDimension = pNewGroupDim.get();     // make changes to the new dim if none existed
 
             if ( pBaseGroupDim )
             {
@@ -2624,10 +2624,10 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons
         if ( pNewGroupDim )
         {
             pDimData->AddGroupDimension( *pNewGroupDim );
-            delete pNewGroupDim;        // AddGroupDimension copies the object
+            pNewGroupDim.reset();        // AddGroupDimension copies the object
             // don't access pGroupDimension after here
         }
-        pGroupDimension = pNewGroupDim = nullptr;
+        pGroupDimension = nullptr;
 
         // set orientation
         ScDPSaveDimension* pSaveDimension = aSaveData.GetDimensionByName( aGroupDimName );


More information about the Libreoffice-commits mailing list