summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-10-26 13:29:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-27 13:21:11 +0200
commit1a6b373d99f6f4b2b4c1a49b3336e520efc0dbdc (patch)
tree71ad4830598d7d0001602f5023208b064fc6a27e /sw
parentbbb104d70dd8130d99e3612e75fb90103c80de7e (diff)
use std::unique_ptr in SwUndoTransliterate
Change-Id: I4c3480104cbec53a395bd11702949984fca452a0 Reviewed-on: https://gerrit.libreoffice.org/43899 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/UndoOverwrite.hxx2
-rw-r--r--sw/source/core/undo/unovwr.cxx6
2 files changed, 3 insertions, 5 deletions
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?