[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 14 07:27:11 UTC 2018
sw/source/core/unocore/unodraw.cxx | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
New commits:
commit 6a40191dc9912a4d4bb1f982aaeda9c107f2a5dd
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 13 12:12:23 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 14 09:26:41 2018 +0200
loplugin:useuniqueptr in SwXDrawPage::add
Change-Id: If929ee4725f65d8695367f38b5203be3a7e426d1
Reviewed-on: https://gerrit.libreoffice.org/60457
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index dd395d9ac00b..da3b4b2d49bf 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -683,12 +683,12 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
else
pObj->SetLayer(pDoc->getIDocumentDrawModelAccess().GetInvisibleControlsId());
- SwPaM* pPam = new SwPaM(pDoc->GetNodes().GetEndOfContent());
- SwUnoInternalPaM* pInternalPam = nullptr;
+ std::unique_ptr<SwPaM> pPam(new SwPaM(pDoc->GetNodes().GetEndOfContent()));
+ std::unique_ptr<SwUnoInternalPaM> pInternalPam;
uno::Reference< text::XTextRange > xRg;
if( pDesc && (xRg = pDesc->GetTextRange()).is() )
{
- pInternalPam = new SwUnoInternalPaM(*pDoc);
+ pInternalPam.reset(new SwUnoInternalPaM(*pDoc));
if (!::sw::XTextRangeToSwPaM(*pInternalPam, xRg))
throw uno::RuntimeException();
@@ -721,9 +721,9 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
// attributes no longer needed, because it's already got a default.
}
aSet.Put(aAnchor);
- SwPaM* pTemp = pInternalPam;
+ SwPaM* pTemp = pInternalPam.get();
if ( !pTemp )
- pTemp = pPam;
+ pTemp = pPam.get();
UnoActionContext aAction(pDoc);
pDoc->getIDocumentContentOperations().InsertDrawObj( *pTemp, *pObj, aSet );
SwFrameFormat* pFormat = ::FindFrameFormat( pObj );
@@ -731,8 +731,8 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
pFormat->Add(pShape);
pShape->m_bDescriptor = false;
- delete pPam;
- delete pInternalPam;
+ pPam.reset();
+ pInternalPam.reset();
}
void SwXDrawPage::remove(const uno::Reference< drawing::XShape > & xShape)
More information about the Libreoffice-commits
mailing list