summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/source/edit/textdat2.hxx6
-rw-r--r--vcl/source/edit/textdata.cxx2
-rw-r--r--vcl/source/edit/texteng.cxx3
-rw-r--r--vcl/source/edit/textundo.cxx1
4 files changed, 3 insertions, 9 deletions
diff --git a/vcl/source/edit/textdat2.hxx b/vcl/source/edit/textdat2.hxx
index cef44ae687b2..27b110b6e322 100644
--- a/vcl/source/edit/textdat2.hxx
+++ b/vcl/source/edit/textdat2.hxx
@@ -212,15 +212,15 @@ public:
class TEParaPortions
{
private:
- std::vector<TEParaPortion*> mvData;
+ std::vector<std::unique_ptr<TEParaPortion>> mvData;
public:
TEParaPortions() : mvData() {}
~TEParaPortions();
sal_uInt32 Count() const { return static_cast<sal_uInt32>(mvData.size()); }
- TEParaPortion* GetObject( sal_uInt32 nIndex ) { return mvData[nIndex]; }
- void Insert( TEParaPortion* pObject, sal_uInt32 nPos ) { mvData.insert( mvData.begin()+nPos, pObject ); }
+ TEParaPortion* GetObject( sal_uInt32 nIndex ) { return mvData[nIndex].get(); }
+ void Insert( TEParaPortion* pObject, sal_uInt32 nPos ) { mvData.emplace( mvData.begin()+nPos, pObject ); }
void Remove( sal_uInt32 nPos ) { mvData.erase( mvData.begin()+nPos ); }
};
diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx
index 72e8b3c309a8..bc8302174cab 100644
--- a/vcl/source/edit/textdata.cxx
+++ b/vcl/source/edit/textdata.cxx
@@ -267,8 +267,6 @@ void TEParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormat
TEParaPortions::~TEParaPortions()
{
- for (auto const& elem : mvData)
- delete elem;
}
IdleFormatter::IdleFormatter()
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 6baa37e08d0a..06d96b716fe5 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -523,7 +523,6 @@ TextPaM TextEngine::ImpConnectParagraphs( sal_uInt32 nLeft, sal_uInt32 nRight )
pLeftPortion->MarkSelectionInvalid( aPaM.GetIndex() );
mpTEParaPortions->Remove( nRight );
- delete pRightPortion;
// the right Node is deleted by EditDoc::ConnectParagraphs()
return aPaM;
@@ -601,7 +600,6 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel )
void TextEngine::ImpRemoveParagraph( sal_uInt32 nPara )
{
TextNode* pNode = mpDoc->GetNodes()[ nPara ];
- std::unique_ptr<TEParaPortion> xPortion(mpTEParaPortions->GetObject( nPara ));
// the Node is handled by Undo and is deleted if appropriate
mpDoc->GetNodes().erase( mpDoc->GetNodes().begin() + nPara );
@@ -611,7 +609,6 @@ void TextEngine::ImpRemoveParagraph( sal_uInt32 nPara )
delete pNode;
mpTEParaPortions->Remove( nPara );
- xPortion.reset();
ImpParagraphRemoved( nPara );
}
diff --git a/vcl/source/edit/textundo.cxx b/vcl/source/edit/textundo.cxx
index 5c58bde20b8a..15cea12cba2e 100644
--- a/vcl/source/edit/textundo.cxx
+++ b/vcl/source/edit/textundo.cxx
@@ -165,7 +165,6 @@ void TextUndoDelPara::Redo()
// pNode is not valid anymore in case an Undo joined paragraphs
mpNode = GetDoc()->GetNodes()[ mnPara ];
- delete GetTEParaPortions()->GetObject( mnPara );
GetTEParaPortions()->Remove( mnPara );
// do not delete Node because of Undo!