diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-13 12:12:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-14 09:26:41 +0200 |
commit | 6a40191dc9912a4d4bb1f982aaeda9c107f2a5dd (patch) | |
tree | 6decd96ae46f2f7b028584cf4d08968b07b15ef1 /sw | |
parent | 52fe7d3196465bd7d4c7e3b4cecda66a7ef0b8ad (diff) |
loplugin:useuniqueptr in SwXDrawPage::add
Change-Id: If929ee4725f65d8695367f38b5203be3a7e426d1
Reviewed-on: https://gerrit.libreoffice.org/60457
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
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) |