Kaydet (Commit) 3ebdb97a authored tarafından Noel Grandin's avatar Noel Grandin

tdf#124413 Crash on undo / redo in Basic IDE

regression from
    commit 3a9d3f27
    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: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e6f7e778
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment