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>
This commit is contained in:
@@ -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);
|
||||
|
@@ -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?
|
||||
|
Reference in New Issue
Block a user