diff --git a/gtk2_ardour/midi_view.cc b/gtk2_ardour/midi_view.cc index fa859d2278..c7f508d0f5 100644 --- a/gtk2_ardour/midi_view.cc +++ b/gtk2_ardour/midi_view.cc @@ -143,6 +143,7 @@ MidiView::MidiView (std::shared_ptr mt, , split_tuple (0) , note_splitting (false) , _extensible (false) + , _redisplaying (false) { init (mt); } @@ -181,6 +182,7 @@ MidiView::MidiView (MidiView const & other) , split_tuple (0) , note_splitting (false) , _extensible (false) + , _redisplaying (false) { init (other._midi_track); } @@ -1140,6 +1142,11 @@ MidiView::redisplay (bool view_only) region_resized (what_changed); } else { + /* Block calls to update note range at all as we add notes in + ::model_changed() + */ + + PBD::Unwinder uw (_redisplaying, true); model_changed (); } } @@ -2038,7 +2045,10 @@ MidiView::add_note (const std::shared_ptr note, bool visible) { NoteBase* event = 0; - _midi_context.maybe_extend_note_range (note->note()); + if (!_redisplaying) { + /* We will catch up on note range somewhere later in ::redisplay() */ + _midi_context.maybe_extend_note_range (note->note()); + } if (_midi_context.note_mode() == Sustained) { diff --git a/gtk2_ardour/midi_view.h b/gtk2_ardour/midi_view.h index c5cffcc8aa..7bdf171f49 100644 --- a/gtk2_ardour/midi_view.h +++ b/gtk2_ardour/midi_view.h @@ -656,6 +656,7 @@ class MidiView : public virtual sigc::trackable, public LineMerger uint32_t split_tuple; bool note_splitting; bool _extensible; /* if true, we can add data beyond the current region/source end */ + bool _redisplaying; /* if true, in the middle of a call to ::redisplay() */ bool extensible() const { return _extensible; } void set_extensible (bool yn) { _extensible = yn; }