improve cleanup of VCA related objects
authorPaul Davis <paul@linuxaudiosystems.com>
Sat, 23 Apr 2016 22:25:32 +0000 (18:25 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 31 May 2016 19:30:41 +0000 (15:30 -0400)
libs/ardour/route.cc
libs/ardour/slavable_automation_control.cc
libs/ardour/vca_manager.cc

index 64f8764303de6a21e3fbda649b3091c6addf5782..78e0228382087aa026e13f794ca34932bdf23a49 100644 (file)
@@ -5442,6 +5442,8 @@ Route::slaved_to (boost::shared_ptr<VCA> vca) const
                return false;
        }
 
+       /* just test one particular control, not all of them */
+
        return _gain_control->slaved_to (vca->gain_control());
 }
 
index 8c50863d954235c0a6f67fd7498d5ad9b8fc74cc..71769ad15578f7e7ce30a941cb692808f51f61f1 100644 (file)
@@ -139,7 +139,7 @@ SlavableAutomationControl::add_master (boost::shared_ptr<AutomationControl> m)
                           itself.
                        */
 
-                       m->DropReferences.connect_same_thread (masters_connections, boost::bind (&SlavableAutomationControl::master_going_away, this, m));
+                       m->DropReferences.connect_same_thread (masters_connections, boost::bind (&SlavableAutomationControl::master_going_away, this, boost::weak_ptr<AutomationControl>(m)));
 
                        /* Store the connection inside the MasterRecord, so that when we destroy it, the connection is destroyed
                           and we no longer hear about changes to the AutomationControl.
@@ -242,6 +242,7 @@ SlavableAutomationControl::remove_master (boost::shared_ptr<AutomationControl> m
 
        pre_remove_master (m);
 
+
        {
                Glib::Threads::RWLock::WriterLock lm (master_lock);
                current_value = get_value_locked ();
index d7ad6ea851fbf11c2d2874806f9a1f3f9c0cb38a..e0d7e0fc824d08ebec4fa698962ea65da711524c 100644 (file)
@@ -48,6 +48,9 @@ void
 VCAManager::clear ()
 {
        Mutex::Lock lm (lock);
+       for (VCAList::const_iterator i = _vcas.begin(); i != _vcas.end(); ++i) {
+               (*i)->DropReferences ();
+       }
        _vcas.clear ();
 }