diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-28 14:53:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-05 15:55:28 +0100 |
commit | 2affed9bfd72628549df3049ed9f6e6a30fdb5b8 (patch) | |
tree | 2447defde1c5587af50c5d7a7aac3ffa8cc7d951 /svx/source | |
parent | af269d967be348b813ea6d9e5e92a95886143622 (diff) |
loplugin:useuniqueptr in SdrObjEditView
Horrible things happening in SdrObjEditView::SdrEndTextEdit, I
can't tell if it's deliberately leaking there, or just changing
ownership in some terribly opaque way.
Change-Id: Idcb30f7e3f1b801901f727b151d3e8dd1124fd3f
Reviewed-on: https://gerrit.libreoffice.org/50663
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 51ef80fb46b6..5b33f7ff6b4c 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -101,7 +101,7 @@ SdrObjEditView::~SdrObjEditView() assert(!IsTextEdit()); if (IsTextEdit()) SdrEndTextEdit(); - delete pTextEditOutliner; + pTextEditOutliner.reset(); assert(nullptr == mpOldTextEditUndoManager); // should have been reset } @@ -820,7 +820,7 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerVie if (pOutlView == nullptr) { - pOutlView = new OutlinerView(pTextEditOutliner, pWin); + pOutlView = new OutlinerView(pTextEditOutliner.get(), pWin); } else { @@ -1078,8 +1078,7 @@ bool SdrObjEditView::SdrBeginTextEdit( if(pTextEditOutliner) { OSL_FAIL("SdrObjEditView::SdrBeginTextEdit(): Old Outliner still exists."); - delete pTextEditOutliner; - pTextEditOutliner = nullptr; + pTextEditOutliner.reset(); } if(!bBrk) @@ -1087,9 +1086,9 @@ bool SdrObjEditView::SdrBeginTextEdit( pTextEditWin=pWin; pTextEditPV=pPV; mxTextEditObj.reset( pObj ); - pTextEditOutliner=pGivenOutliner; + pTextEditOutliner.reset(pGivenOutliner); if (pTextEditOutliner==nullptr) - pTextEditOutliner = SdrMakeOutliner( OutlinerMode::TextObject, *mxTextEditObj->GetModel() ); + pTextEditOutliner.reset(SdrMakeOutliner( OutlinerMode::TextObject, *mxTextEditObj->GetModel() )); { SvtAccessibilityOptions aOptions; @@ -1335,9 +1334,7 @@ bool SdrObjEditView::SdrBeginTextEdit( pGivenOutlinerView = nullptr; } } - delete pTextEditOutliner; - - pTextEditOutliner=nullptr; + pTextEditOutliner.reset(); pTextEditOutlinerView=nullptr; mxTextEditObj.reset(nullptr); pTextEditPV=nullptr; @@ -1352,7 +1349,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) SdrEndTextEditKind eRet=SdrEndTextEditKind::Unchanged; SdrTextObj* pTEObj = mxTextEditObj.get(); vcl::Window* pTEWin =pTextEditWin; - SdrOutliner* pTEOutliner =pTextEditOutliner; + SdrOutliner* pTEOutliner =pTextEditOutliner.release(); OutlinerView* pTEOutlinerView=pTextEditOutlinerView; vcl::Cursor* pTECursorMerker=pTextEditCursorMerker; SdrUndoManager* pUndoEditUndoManager = nullptr; @@ -1422,7 +1419,6 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) mxTextEditObj.reset(nullptr); pTextEditPV=nullptr; pTextEditWin=nullptr; - pTextEditOutliner=nullptr; pTextEditOutlinerView=nullptr; pTextEditCursorMerker=nullptr; aTextEditArea=tools::Rectangle(); @@ -1927,7 +1923,7 @@ bool SdrObjEditView::ImpIsTextEditAllSelected() const bool bRet=false; if (pTextEditOutliner!=nullptr && pTextEditOutlinerView!=nullptr) { - if(SdrTextObj::HasTextImpl( pTextEditOutliner ) ) + if(SdrTextObj::HasTextImpl( pTextEditOutliner.get() ) ) { const sal_Int32 nParaCnt=pTextEditOutliner->GetParagraphCount(); Paragraph* pLastPara=pTextEditOutliner->GetParagraph( nParaCnt > 1 ? nParaCnt - 1 : 0 ); |