13
0

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 7cf435a876 (6.5.148)
This commit is contained in:
Robin Gareus 2021-02-28 14:58:18 +01:00
parent 770fd1519c
commit f8ba27f417
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -5334,8 +5334,9 @@ Editor::region_view_added (RegionView * rv)
list<pair<PBD::ID const, list<Evoral::event_id_t> > >::iterator rnote; list<pair<PBD::ID const, list<Evoral::event_id_t> > >::iterator rnote;
for (rnote = selection->pending_midi_note_selection.begin(); rnote != selection->pending_midi_note_selection.end(); ++rnote) { for (rnote = selection->pending_midi_note_selection.begin(); rnote != selection->pending_midi_note_selection.end(); ++rnote) {
if (rv->region()->id () == (*rnote).first) { if (rv->region()->id () == (*rnote).first) {
mrv->select_notes ((*rnote).second, false); list<Evoral::event_id_t> notes ((*rnote).second);
selection->pending_midi_note_selection.erase(rnote); selection->pending_midi_note_selection.erase(rnote);
mrv->select_notes (notes, false); // NB. this may change the selection
break; break;
} }
} }