summaryrefslogtreecommitdiff
path: root/libs/ardour/automatable.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-08-31 18:52:37 -0400
committerDavid Robillard <d@drobilla.net>2014-08-31 18:57:22 -0400
commit34c1465cf9645fce4e05299f6e5a2e7af19a0d3e (patch)
tree112bed277ad89ebeb0e517e72e668d250a23e862 /libs/ardour/automatable.cc
parentb012f2cd1825d2e25e706c35a61b8fbd0ee1af41 (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/ardour/automatable.cc')
-rw-r--r--libs/ardour/automatable.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc
index 7669f22df1..8629722889 100644
--- a/libs/ardour/automatable.cc
+++ b/libs/ardour/automatable.cc
@@ -137,16 +137,20 @@ Automatable::add_control(boost::shared_ptr<Evoral::Control> ac)
Evoral::Parameter param = ac->parameter();
boost::shared_ptr<AutomationList> al = boost::dynamic_pointer_cast<AutomationList> (ac->list ());
- assert (al);
- al->automation_state_changed.connect_same_thread (
- _list_connections, boost::bind (&Automatable::automation_list_automation_state_changed, this, ac->parameter(), _1)
- );
+ if (al) {
+ al->automation_state_changed.connect_same_thread (
+ _list_connections,
+ boost::bind (&Automatable::automation_list_automation_state_changed,
+ this, ac->parameter(), _1));
+ }
ControlSet::add_control (ac);
_can_automate_list.insert (param);
- automation_list_automation_state_changed (param, al->automation_state ()); // sync everything up
+ if (al) {
+ automation_list_automation_state_changed (param, al->automation_state ()); // sync everything up
+ }
}
string
@@ -394,6 +398,7 @@ Automatable::control_factory(const Evoral::Parameter& param)
MidiTrack* mt = dynamic_cast<MidiTrack*>(this);
if (mt) {
control = new MidiTrack::MidiControl(mt, param);
+ list.reset(); // No list, this is region "automation"
} else {
warning << "MidiCCAutomation for non-MidiTrack" << endl;
}