fix crash caused by VelocityDisplay _optimization_iterator
Never use the _optimization_iterator when looking for a note to update or select because those two conditions may be preceded by note add/delete operations (including those via undo/redo) which would make the iterator invalid. The _optimization_iterator only makes sense when actually iterating over the event list, which is ironic because that's the one time we don't need it
This commit is contained in:
parent
96ef4d20f2
commit
cdf88efeff
@ -203,12 +203,15 @@ VelocityDisplay::set_size_and_position (GhostEvent& gev)
|
||||
void
|
||||
VelocityDisplay::update_note (NoteBase* nb)
|
||||
{
|
||||
GhostEvent* gev = GhostEvent::find (nb->note(), events, _optimization_iterator);
|
||||
auto iter = events.end();
|
||||
|
||||
GhostEvent* gev = GhostEvent::find (nb->note(), events, iter);
|
||||
|
||||
if (!gev) {
|
||||
return;
|
||||
}
|
||||
|
||||
_optimization_iterator = iter;
|
||||
update_ghost_event (gev);
|
||||
}
|
||||
|
||||
@ -319,7 +322,9 @@ VelocityDisplay::y_position_to_velocity (double y) const
|
||||
void
|
||||
VelocityDisplay::note_selected (NoteBase* ev)
|
||||
{
|
||||
GhostEvent* gev = GhostEvent::find (ev->note(), events, _optimization_iterator);
|
||||
auto ignore_optiter = events.end();
|
||||
|
||||
GhostEvent* gev = GhostEvent::find (ev->note(), events, ignore_optiter);
|
||||
|
||||
if (!gev) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user