include/svx/svdundo.hxx | 6 ++++-- svx/source/svdraw/svdundo.cxx | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-)
New commits: commit f4b9c35c018ccacd7f8cf71c534863239b0da02c Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Feb 5 11:01:07 2018 +0200 loplugin:useuniqueptr in SdrUndoObjSetText Change-Id: Idd1eb8263d679efed0f0be88fb05963fe44f8668 Reviewed-on: https://gerrit.libreoffice.org/49328 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx index 793782d37ed1..9cb4271d0a86 100644 --- a/include/svx/svdundo.hxx +++ b/include/svx/svdundo.hxx @@ -398,8 +398,10 @@ public: class SVX_DLLPUBLIC SdrUndoObjSetText : public SdrUndoObj { protected: - OutlinerParaObject* pOldText; - OutlinerParaObject* pNewText; + std::unique_ptr<OutlinerParaObject> + pOldText; + std::unique_ptr<OutlinerParaObject> + pNewText; bool bNewTextAvailable; bool bEmptyPresObj; sal_Int32 mnText; diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index ba2bff175356..3f607186f87f 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -1032,15 +1032,15 @@ SdrUndoObjSetText::SdrUndoObjSetText(SdrObject& rNewObj, sal_Int32 nText) { SdrText* pText = static_cast< SdrTextObj*>( &rNewObj )->getText(mnText); if( pText && pText->GetOutlinerParaObject() ) - pOldText = new OutlinerParaObject(*pText->GetOutlinerParaObject()); + pOldText.reset( new OutlinerParaObject(*pText->GetOutlinerParaObject()) ); bEmptyPresObj = rNewObj.IsEmptyPresObj(); } SdrUndoObjSetText::~SdrUndoObjSetText() { - delete pOldText; - delete pNewText; + pOldText.reset(); + pNewText.reset(); } void SdrUndoObjSetText::AfterSetText() @@ -1049,7 +1049,7 @@ void SdrUndoObjSetText::AfterSetText() { SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); if( pText && pText->GetOutlinerParaObject() ) - pNewText = new OutlinerParaObject(*pText->GetOutlinerParaObject()); + pNewText.reset( new OutlinerParaObject(*pText->GetOutlinerParaObject()) ); bNewTextAvailable=true; } } @@ -1172,7 +1172,7 @@ void SdrUndoObjSetText::SdrRepeat(SdrView& rView) if( bUndo ) rView.AddUndo(new SdrUndoObjSetText(*pTextObj,0)); - OutlinerParaObject* pText1=pNewText; + OutlinerParaObject* pText1=pNewText.get(); if (pText1!=nullptr) pText1 = new OutlinerParaObject(*pText1); pTextObj->SetOutlinerParaObject(pText1); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits