From f8ba27f417f05c94f794147cc8cd256a0090cf7b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 28 Feb 2021 14:58:18 +0100 Subject: [PATCH] Work around crash #8586 MidiRegionView::select_notes() may call MRV::add_to_selection which may call editor().get_selection().clear (); This in turn clears the pending_midi_note_selection, invalidating iterator. This bug was introduced in 7cf435a8765b6795 (6.5.148) --- gtk2_ardour/editor.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index ad9cf91e4f..8a936af53c 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -5334,8 +5334,9 @@ Editor::region_view_added (RegionView * rv) list > >::iterator rnote; for (rnote = selection->pending_midi_note_selection.begin(); rnote != selection->pending_midi_note_selection.end(); ++rnote) { if (rv->region()->id () == (*rnote).first) { - mrv->select_notes ((*rnote).second, false); + list notes ((*rnote).second); selection->pending_midi_note_selection.erase(rnote); + mrv->select_notes (notes, false); // NB. this may change the selection break; } }