[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Jul 16 06:38:18 UTC 2018
sw/source/core/inc/UndoRedline.hxx | 6 +++---
sw/source/core/undo/unredln.cxx | 27 ++++++++++++---------------
2 files changed, 15 insertions(+), 18 deletions(-)
New commits:
commit fc6c9de5e88f849d44dcecf775b60c366d5e41d8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 13 11:02:16 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 16 08:37:56 2018 +0200
loplugin:useuniqueptr in SwUndoCompDoc
Change-Id: I3a74f017b2b82476034f1c92a509c1d5bb20de35
Reviewed-on: https://gerrit.libreoffice.org/57418
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/inc/UndoRedline.hxx b/sw/source/core/inc/UndoRedline.hxx
index 0de085da5bbe..76f478ad89d6 100644
--- a/sw/source/core/inc/UndoRedline.hxx
+++ b/sw/source/core/inc/UndoRedline.hxx
@@ -118,9 +118,9 @@ public:
class SwUndoCompDoc : public SwUndo, public SwUndRng
{
- SwRedlineData* pRedlData;
- SwUndoDelete* pUnDel, *pUnDel2;
- SwRedlineSaveDatas* pRedlSaveData;
+ std::unique_ptr<SwRedlineData> pRedlData;
+ std::unique_ptr<SwUndoDelete> pUnDel, pUnDel2;
+ std::unique_ptr<SwRedlineSaveDatas> pRedlSaveData;
bool bInsert;
public:
diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx
index 2d3faa3194ad..5a7334beb7ac 100644
--- a/sw/source/core/undo/unredln.cxx
+++ b/sw/source/core/undo/unredln.cxx
@@ -378,7 +378,7 @@ SwUndoCompDoc::SwUndoCompDoc( const SwPaM& rRg, bool bIns )
if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
RedlineType_t eTyp = bInsert ? nsRedlineType_t::REDLINE_INSERT : nsRedlineType_t::REDLINE_DELETE;
- pRedlData = new SwRedlineData( eTyp, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() );
+ pRedlData.reset( new SwRedlineData( eTyp, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() ) );
SetRedlineFlags( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
}
}
@@ -392,24 +392,23 @@ SwUndoCompDoc::SwUndoCompDoc( const SwRangeRedline& rRedl )
SwDoc* pDoc = rRedl.GetDoc();
if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
- pRedlData = new SwRedlineData( rRedl.GetRedlineData() );
+ pRedlData.reset( new SwRedlineData( rRedl.GetRedlineData() ) );
SetRedlineFlags( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
}
- pRedlSaveData = new SwRedlineSaveDatas;
+ pRedlSaveData.reset( new SwRedlineSaveDatas );
if( !FillSaveData( rRedl, *pRedlSaveData, false ))
{
- delete pRedlSaveData;
- pRedlSaveData = nullptr;
+ pRedlSaveData.reset();
}
}
SwUndoCompDoc::~SwUndoCompDoc()
{
- delete pRedlData;
- delete pUnDel;
- delete pUnDel2;
- delete pRedlSaveData;
+ pRedlData.reset();
+ pUnDel.reset();
+ pUnDel2.reset();
+ pRedlSaveData.reset();
}
void SwUndoCompDoc::UndoImpl(::sw::UndoRedoContext & rContext)
@@ -441,7 +440,7 @@ void SwUndoCompDoc::UndoImpl(::sw::UndoRedoContext & rContext)
bool bJoinText, bJoinPrev;
sw_GetJoinFlags(rPam, bJoinText, bJoinPrev);
- pUnDel = new SwUndoDelete(rPam, false);
+ pUnDel.reset( new SwUndoDelete(rPam, false) );
if( bJoinText )
sw_JoinText(rPam, bJoinPrev);
@@ -458,7 +457,7 @@ void SwUndoCompDoc::UndoImpl(::sw::UndoRedoContext & rContext)
++rPam.GetPoint()->nNode;
rPam.GetBound().nContent.Assign( nullptr, 0 );
rPam.GetBound( false ).nContent.Assign( nullptr, 0 );
- pUnDel2 = new SwUndoDelete(rPam, true);
+ pUnDel2.reset( new SwUndoDelete(rPam, true) );
}
}
rPam.DeleteMark();
@@ -501,12 +500,10 @@ void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext)
if( pUnDel2 )
{
pUnDel2->UndoImpl(rContext);
- delete pUnDel2;
- pUnDel2 = nullptr;
+ pUnDel2.reset();
}
pUnDel->UndoImpl(rContext);
- delete pUnDel;
- pUnDel = nullptr;
+ pUnDel.reset();
// note: don't call SetPaM before executing Undo of members
SwPaM& rPam(AddUndoRedoPaM(rContext));
More information about the Libreoffice-commits
mailing list