[Libreoffice-commits] core.git: sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Fri Oct 27 11:21:33 UTC 2017
sw/source/core/inc/UndoOverwrite.hxx | 2 +-
sw/source/core/undo/unovwr.cxx | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
New commits:
commit 1a6b373d99f6f4b2b4c1a49b3336e520efc0dbdc
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Oct 26 13:29:38 2017 +0200
use std::unique_ptr in SwUndoTransliterate
Change-Id: I4c3480104cbec53a395bd11702949984fca452a0
Reviewed-on: https://gerrit.libreoffice.org/43899
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/inc/UndoOverwrite.hxx b/sw/source/core/inc/UndoOverwrite.hxx
index ff55c06ea32a..a406834105be 100644
--- a/sw/source/core/inc/UndoOverwrite.hxx
+++ b/sw/source/core/inc/UndoOverwrite.hxx
@@ -69,7 +69,7 @@ public:
struct UndoTransliterate_Data;
class SwUndoTransliterate : public SwUndo, public SwUndRng
{
- std::vector< UndoTransliterate_Data * > aChanges;
+ std::vector< std::unique_ptr<UndoTransliterate_Data> > aChanges;
TransliterationFlags nType;
void DoTransliterate(SwDoc & rDoc, SwPaM const & rPam);
diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx
index 475e9ec3f1af..2911e66a42dd 100644
--- a/sw/source/core/undo/unovwr.cxx
+++ b/sw/source/core/undo/unovwr.cxx
@@ -345,8 +345,6 @@ SwUndoTransliterate::SwUndoTransliterate(
SwUndoTransliterate::~SwUndoTransliterate()
{
- for (UndoTransliterate_Data* p : aChanges)
- delete p;
}
void SwUndoTransliterate::UndoImpl(::sw::UndoRedoContext & rContext)
@@ -389,7 +387,7 @@ void SwUndoTransliterate::AddChanges( SwTextNode& rTNd,
rTNd.GetIndex(), nStart, (sal_Int32)nOffsLen,
rTNd.GetText().copy(nStart, nLen));
- aChanges.push_back( pNew );
+ aChanges.push_back( std::unique_ptr<UndoTransliterate_Data>(pNew) );
const sal_Int32* pOffsets = rOffsets.getConstArray();
// where did we need less memory ?
@@ -426,7 +424,7 @@ void SwUndoTransliterate::AddChanges( SwTextNode& rTNd,
// but this data must moved every time to the last in the chain!
for (size_t i = 0; i + 1 < aChanges.size(); ++i) // check all changes but not the current one
{
- UndoTransliterate_Data* pD = aChanges[i];
+ UndoTransliterate_Data* pD = aChanges[i].get();
if( pD->nNdIdx == pNew->nNdIdx && pD->pHistory )
{
// same node and have a history?
More information about the Libreoffice-commits
mailing list