diff options
author | David Robillard <d@drobilla.net> | 2014-08-31 18:52:37 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-08-31 18:57:22 -0400 |
commit | 34c1465cf9645fce4e05299f6e5a2e7af19a0d3e (patch) | |
tree | 112bed277ad89ebeb0e517e72e668d250a23e862 /libs/evoral/src | |
parent | b012f2cd1825d2e25e706c35a61b8fbd0ee1af41 (diff) |
Fix crash when changing automation mode for MIDI track control automation.
Also some work towards tolerating automation controls with no automation list,
towards actually doing something for these cases, though not required just to
fix this crash (MidiTrack::set_parameter_automation_state() avoids those
paths).
Diffstat (limited to 'libs/evoral/src')
-rw-r--r-- | libs/evoral/src/ControlSet.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libs/evoral/src/ControlSet.cpp b/libs/evoral/src/ControlSet.cpp index 393b819146..f24c410d73 100644 --- a/libs/evoral/src/ControlSet.cpp +++ b/libs/evoral/src/ControlSet.cpp @@ -45,9 +45,12 @@ ControlSet::add_control(boost::shared_ptr<Control> ac) ac->ListMarkedDirty.connect_same_thread (_control_connections, boost::bind (&ControlSet::control_list_marked_dirty, this)); - ac->list()->InterpolationChanged.connect_same_thread ( - _list_connections, boost::bind (&ControlSet::control_list_interpolation_changed, this, ac->parameter(), _1) - ); + if (ac->list()) { + ac->list()->InterpolationChanged.connect_same_thread ( + _list_connections, + boost::bind (&ControlSet::control_list_interpolation_changed, + this, ac->parameter(), _1)); + } } void @@ -95,6 +98,9 @@ ControlSet::find_next_event (double now, double end, ControlEvent& next_event) c ControlList::const_iterator i; boost::shared_ptr<const ControlList> alist (li->second->list()); ControlEvent cp (now, 0.0f); + if (!alist) { + continue; + } for (i = lower_bound (alist->begin(), alist->end(), &cp, ControlList::time_comparator); i != alist->end() && (*i)->when < end; ++i) { @@ -121,8 +127,11 @@ ControlSet::clear_controls () _control_connections.drop_connections (); _list_connections.drop_connections (); - for (Controls::iterator li = _controls.begin(); li != _controls.end(); ++li) - li->second->list()->clear(); + for (Controls::iterator li = _controls.begin(); li != _controls.end(); ++li) { + if (li->second->list()) { + li->second->list()->clear(); + } + } } } // namespace Evoral |