summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-12 10:26:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-13 08:31:34 +0200
commit9abbe6746cb4d36e3ccb384f96ccafb9e0612cd6 (patch)
tree7079cbf3ead1e1459f566906fb7cde014fce333c
parent43125f3b0b18b8d9bac9bd459fa234cb5ff9ddb4 (diff)
loplugin:useuniqueptr in lcl_UpdateLinksInSect
Change-Id: Id9e8f142b8cc4b2a4418b3cde59e98bb7f045fe6 Reviewed-on: https://gerrit.libreoffice.org/60410 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/core/docnode/section.cxx8
1 files changed, 3 insertions, 5 deletions
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;
}