summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-01 14:38:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-04 14:32:10 +0200
commit0d66d95df3bf930926e888dfe8a8060d7c037d6e (patch)
treed6aa4108fedeae6dd3993249ff127a1fa23d1e02
parentb94fff58381a58cc737dfb4df9c2ee961e0fe2f6 (diff)
tdf#124413 Crash on undo / redo in Basic IDE
regression from commit 3a9d3f271c445641bebd057c4c91279f9b3cd7d5 Date: Mon Apr 23 09:38:41 2018 +0200 loplugin:useuniqueptr in TextDoc Change-Id: I51ab5de7571e4ec358442e54d590adf88fbeb12d Reviewed-on: https://gerrit.libreoffice.org/70061 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 3ebdb97a305ada182af045ea6438432adfe74e80) Reviewed-on: https://gerrit.libreoffice.org/70076 Tested-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org> Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
-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 80e26d34c577..adbf8be9076c 100644
--- a/vcl/source/edit/textundo.cxx
+++ b/vcl/source/edit/textundo.cxx
@@ -163,14 +163,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