diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h index 46643dc6fa..359d98856c 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -85,7 +85,7 @@ public: bool paste (const ControlList&, double, DoubleBeatsFramesConverter const&); void set_automation_state (AutoState); - AutoState automation_state() const { return _state; } + AutoState automation_state() const; PBD::Signal1 automation_state_changed; bool automation_playback() const { diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index d92e65288f..3ffc040b62 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -192,16 +192,28 @@ AutomationList::maybe_signal_changed () } } +AutoState +AutomationList::automation_state() const +{ + Glib::Threads::RWLock::ReaderLock lm (Evoral::ControlList::_lock); + return _state; +} + void AutomationList::set_automation_state (AutoState s) { - if (s == _state) { - return; - } - _state = s; - if (s == Write && _desc.toggled) { - snapshot_history (true); + { + Glib::Threads::RWLock::ReaderLock lm (Evoral::ControlList::_lock); + + if (s == _state) { + return; + } + _state = s; + if (s == Write && _desc.toggled) { + snapshot_history (true); + } } + automation_state_changed (s); /* EMIT SIGNAL */ } @@ -588,4 +600,3 @@ AutomationListProperty::clone () const boost::shared_ptr (new AutomationList (*this->_current.get())) ); } -