diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-03 14:35:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-04 08:30:29 +0200 |
commit | 4fa280ced35631d5b51a2ac426912090e26ab903 (patch) | |
tree | 56d1cf285621cd7be6aaefe92c4efe7a1bd0c2a0 | |
parent | a9d6a2584fcd36fd9e91b7339b38cc6bd524361a (diff) |
loplugin:useuniqueptr in SwAutoCorrDoc
Change-Id: I1ec0a760c10b7e1da9d1c2a106bba60d84ff23f4
Reviewed-on: https://gerrit.libreoffice.org/52343
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/source/core/edit/acorrect.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/inc/acorrect.hxx | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index d2595462212f..709db86d2b76 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -83,7 +83,7 @@ void PaMIntoCursorShellRing::RemoveFromRing( SwPaM& rPam, SwPaM const * pPrev ) SwAutoCorrDoc::SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam, sal_Unicode cIns ) - : rEditSh( rEditShell ), rCursor( rPam ), pIdx( nullptr ) + : rEditSh( rEditShell ), rCursor( rPam ) , m_nEndUndoCounter(0) , bUndoIdInitialized( cIns == 0 ) { @@ -95,7 +95,6 @@ SwAutoCorrDoc::~SwAutoCorrDoc() { rEditSh.EndUndo(); } - delete pIdx; } void SwAutoCorrDoc::DeleteSel( SwPaM& rDelPam ) @@ -276,7 +275,7 @@ OUString const* SwAutoCorrDoc::GetPrevPara(bool const bAtNormalPos) OUString const* pStr(nullptr); if( bAtNormalPos || !pIdx ) - pIdx = new SwNodeIndex( rCursor.GetPoint()->nNode, -1 ); + pIdx.reset(new SwNodeIndex( rCursor.GetPoint()->nNode, -1 )); else --(*pIdx); @@ -360,7 +359,7 @@ bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos, if( pPara ) { OSL_ENSURE( !pIdx, "who has not deleted his Index?" ); - pIdx = new SwNodeIndex( rCursor.GetPoint()->nNode, -1 ); + pIdx.reset(new SwNodeIndex( rCursor.GetPoint()->nNode, -1 )); } SwDoc* pAutoDoc = aTBlks.GetDoc(); diff --git a/sw/source/core/inc/acorrect.hxx b/sw/source/core/inc/acorrect.hxx index f2382dbeddde..caae1184e99f 100644 --- a/sw/source/core/inc/acorrect.hxx +++ b/sw/source/core/inc/acorrect.hxx @@ -48,7 +48,7 @@ class SwAutoCorrDoc : public SvxAutoCorrDoc { SwEditShell& rEditSh; SwPaM& rCursor; - SwNodeIndex* pIdx; + std::unique_ptr<SwNodeIndex> pIdx; int m_nEndUndoCounter; bool bUndoIdInitialized; |