summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vcl/source/edit/textundo.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/vcl/source/edit/textundo.cxx b/vcl/source/edit/textundo.cxx
index e5b3d0165517..5c99f30d94b0 100644
--- a/vcl/source/edit/textundo.cxx
+++ b/vcl/source/edit/textundo.cxx
@@ -162,14 +162,19 @@ void TextUndoDelPara::Undo()
void TextUndoDelPara::Redo()
{
+ auto & rDocNodes = GetDoc()->GetNodes();
// pNode is not valid anymore in case an Undo joined paragraphs
- mpNode = GetDoc()->GetNodes()[ mnPara ].get();
+ mpNode = rDocNodes[ mnPara ].get();
GetTEParaPortions()->Remove( mnPara );
// do not delete Node because of Undo!
- GetDoc()->GetNodes().erase( ::std::find_if( GetDoc()->GetNodes().begin(), GetDoc()->GetNodes().end(),
- [&] (std::unique_ptr<TextNode> const & p) { return p.get() == mpNode; } ) );
+ auto it = ::std::find_if( rDocNodes.begin(), rDocNodes.end(),
+ [&] (std::unique_ptr<TextNode> const & p) { return p.get() == mpNode; } );
+ assert(it != rDocNodes.end());
+ it->release();
+ GetDoc()->GetNodes().erase( it );
+
GetTextEngine()->ImpParagraphRemoved( mnPara );
mbDelObject = true; // belongs again to the Undo