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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 13 06:32:01 UTC 2018


 sc/source/ui/navipi/content.cxx    |    6 ++----
 sw/source/core/docnode/section.cxx |    8 +++-----
 2 files changed, 5 insertions(+), 9 deletions(-)

New commits:
commit d92b0efe58b77247e1e5292c1a989baa934df797
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Sep 12 10:44:14 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Sep 13 08:31:45 2018 +0200

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

diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index ad7ea280d8c7..6ab4e597fa15 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1306,7 +1306,7 @@ static void lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, ScDra
 
 void ScContentTree::DoDrag()
 {
-    ScDocumentLoader* pDocLoader = nullptr;
+    std::unique_ptr<ScDocumentLoader> pDocLoader;
     bIsInDrag = true;
 
     ScModule* pScMod = SC_MOD();
@@ -1395,7 +1395,7 @@ void ScContentTree::DoDrag()
                     {
                         OUString aFilter, aOptions;
                         OUString aURL = aHiddenName;
-                        pDocLoader = new ScDocumentLoader( aURL, aFilter, aOptions );
+                        pDocLoader.reset(new ScDocumentLoader( aURL, aFilter, aOptions ));
                         if (!pDocLoader->IsError())
                             pSrcShell = pDocLoader->GetDocShell();
                     }
@@ -1450,8 +1450,6 @@ void ScContentTree::DoDrag()
     }
 
     bIsInDrag = false;              // static member
-
-    delete pDocLoader;              // if document was load for dragging
 }
 
 IMPL_LINK_NOARG(ScContentTree, ExecDragHdl, void*, void)
commit 9abbe6746cb4d36e3ccb384f96ccafb9e0612cd6
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Sep 12 10:26:24 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Sep 13 08:31:34 2018 +0200

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

diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 8eecfc5ac4c7..5c6170ad5869 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1192,7 +1192,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
     bool bWasVisibleLinks = pDoc->getIDocumentLinksAdministration().IsVisibleLinks();
     pDoc->getIDocumentLinksAdministration().SetVisibleLinks( false );
 
-    SwPaM* pPam;
+    std::unique_ptr<SwPaM> pPam;
     SwViewShell* pVSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
     SwEditShell* pESh = pDoc->GetEditShell();
     pDoc->getIDocumentFieldsAccess().LockExpFields();
@@ -1212,7 +1212,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
         --aPos.nNode;
         SwDoc::CorrAbs( aIdx, aEndIdx, aPos, true );
 
-        pPam = new SwPaM( aPos );
+        pPam.reset(new SwPaM( aPos ));
 
         // Delete everything succeeding it
         --aIdx;
@@ -1396,8 +1396,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
             pESh->Push();
             SwPaM* pCursor = pESh->GetCursor();
             *pCursor->GetPoint() = *pPam->GetPoint();
-            delete pPam;
-            pPam = pCursor;
+            pPam.reset(pCursor);
         }
 
         SvMemoryStream aStrm( const_cast<sal_Int8 *>(aSeq.getConstArray()), aSeq.getLength(),
@@ -1432,7 +1431,6 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
         pESh->EndAllAction();
     else if( pVSh )
         pVSh->EndAction();
-    delete pPam; // Was created at the start
 
     return SUCCESS;
 }


More information about the Libreoffice-commits mailing list