diff options
author | Robin Gareus <robin@gareus.org> | 2017-06-09 22:54:09 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-06-09 23:25:42 +0200 |
commit | a1b4f9b8abf2887b17bce05403ea7eab2421f26a (patch) | |
tree | a104cbcde53d6efa1959ac451a43088292ee85d4 /libs/ardour/ardour/slavable_automation_control.h | |
parent | 8502aa18c5e69cee79780d370ab6fa88cf7de484 (diff) |
Fix deletion of VCA with slaved controls.
The crashed previously because:
A VCA is-a Automatable is-a Evoral::ControlSet
After VCA's d'tor completes ~Automatable runs and emits signal to
DropReferences of all master-controls.
This in turn calls SlavableAutomationControl::master_going_away()
for slaved parameters for the given master-control
In ::master_going_away() the weak-pointer reference to the master's
AutomationControl (owned by the destroyed VCA) is still valid.
Execution is in the d'tor of Automatable which is-a ControlSet and
the ContolSet keeps a reference to the Control and hence also to the
AutomationControl which is-a Evoral::Control.
So master_going_away() locks a boost::shared_ptr<ARDOUR::AutomationControl>
which is actually the MuteControl owned by the VCA.
It calls SlavableAutomationControl::remove_master() which
in turn calls MuteControl::pre_remove_master() which uses the
MuteMaster API to retrieve the value. The MuteMaster however is the
VCA that has just been destroyed.
The solution is twofold:
1) emit "drop_references" from the VCA d'tor itself,
before the VCA is destroyed.
2) disconnect a slaved control from the master's drop_references signal
when un-assigning a master-control.
Diffstat (limited to 'libs/ardour/ardour/slavable_automation_control.h')
-rw-r--r-- | libs/ardour/ardour/slavable_automation_control.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/ardour/ardour/slavable_automation_control.h b/libs/ardour/ardour/slavable_automation_control.h index f89d29c0d2..acb5ad7471 100644 --- a/libs/ardour/ardour/slavable_automation_control.h +++ b/libs/ardour/ardour/slavable_automation_control.h @@ -36,7 +36,7 @@ class LIBARDOUR_API SlavableAutomationControl : public AutomationControl PBD::Controllable::Flag flags=PBD::Controllable::Flag (0) ); - ~SlavableAutomationControl (); + virtual ~SlavableAutomationControl (); double get_value () const; @@ -110,7 +110,7 @@ class LIBARDOUR_API SlavableAutomationControl : public AutomationControl mutable Glib::Threads::RWLock master_lock; typedef std::map<PBD::ID,MasterRecord> Masters; Masters _masters; - PBD::ScopedConnectionList masters_connections; + std::map<boost::weak_ptr<AutomationControl>, PBD::ScopedConnection> masters_connections; void master_going_away (boost::weak_ptr<AutomationControl>); double get_value_locked() const; |