From aa80321976726b745741ce525f2b1b1becb29671 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 4 Mar 2016 16:09:14 -0500 Subject: fix deadlock caused by VCA=>VCA slaving and set_state() --- libs/ardour/vca_manager.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'libs/ardour/vca_manager.cc') diff --git a/libs/ardour/vca_manager.cc b/libs/ardour/vca_manager.cc index c8e3a009e4..9a96dc8a38 100644 --- a/libs/ardour/vca_manager.cc +++ b/libs/ardour/vca_manager.cc @@ -140,13 +140,18 @@ VCAManager::set_state (XMLNode const& node, int version) XMLNodeList const & children = node.children(); VCAList vcal; - { - - Mutex::Lock lm (lock); - - for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) { - if ((*i)->name() == VCA::xml_node_name) { - boost::shared_ptr vca = boost::shared_ptr (new VCA (_session, **i, version)); + for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) { + if ((*i)->name() == VCA::xml_node_name) { + boost::shared_ptr vca = boost::shared_ptr (new VCA (_session, **i, version)); + + /* can't hold the lock for the entire loop, + * because the new VCA maybe slaved and needs + * to call back into us to set up its own + * slave/master relationship + */ + + { + Mutex::Lock lm (lock); _vcas.push_back (vca); vcal.push_back (vca); } -- cgit v1.2.3