mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 13:46:30 +01:00
Fix occasional MIDI read crash.
Locking should prevent this from being a problem, but taking a reference to the cached iterator and mutating it directly causes occasional crashes for me for reasons I can't quite figure out. This fixes the issue and is arguably more sane anyway, so whatever.
This commit is contained in:
parent
dbc2f59453
commit
ec947ff8fd
1 changed files with 4 additions and 3 deletions
|
|
@ -200,11 +200,10 @@ MidiSource::midi_read (const Lock& lm,
|
|||
|
||||
if (_model) {
|
||||
// Find appropriate model iterator
|
||||
Evoral::Sequence<Evoral::MusicalTime>::const_iterator& i = _model_iter;
|
||||
Evoral::Sequence<Evoral::MusicalTime>::const_iterator i = _model_iter;
|
||||
if (_last_read_end == 0 || start != _last_read_end || !_model_iter_valid) {
|
||||
// Cached iterator is invalid, search for the first event past start
|
||||
i = _model->begin(converter.from(start), false, filtered);
|
||||
_model_iter_valid = true;
|
||||
i = _model->begin(converter.from(start), false, filtered);
|
||||
}
|
||||
|
||||
_last_read_end = start + cnt;
|
||||
|
|
@ -230,6 +229,8 @@ MidiSource::midi_read (const Lock& lm,
|
|||
break;
|
||||
}
|
||||
}
|
||||
_model_iter = i;
|
||||
_model_iter_valid = true;
|
||||
return cnt;
|
||||
} else {
|
||||
return read_unlocked (lm, dst, source_start, start, cnt, tracker);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue