summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-01-12 21:47:15 +0100
committerRobin Gareus <robin@gareus.org>2014-01-12 21:47:15 +0100
commit7e3282486d9638b6cfa1cd727a793df949270091 (patch)
treef23046439a5b530967153b9e3f14285c35f0220e
parent0e77e578cc6001a8b5634f6eaad30f565906a472 (diff)
take process lock when adding processors:
fixes possible crash if a processor modifies port-count 1. a processor is inserted and activated with processor-lock held 2. only after that the process_lock() is taken, configure_processors() is called which reconfigures-IO BUT if the processor that is inserted changes the channel count AND audio is processed before IOs are reconfigured -> possible crash (invalid port-buffers) To reproduce: Bus1 (2in, 3out), Bus2 (2in, 3out) - add a send from Bus1 to Bus2, - then add a processor to Bus1, just before the send which increases the channel-count to 4 -> occasional crash or assert.
-rw-r--r--libs/ardour/route.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 6f23e920d4..e819666a3a 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -947,6 +947,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, boost::shared_ptr<
{
Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this);
+ Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
boost::shared_ptr<PluginInsert> pi;
boost::shared_ptr<PortInsert> porti;
@@ -986,8 +987,6 @@ Route::add_processor (boost::shared_ptr<Processor> processor, boost::shared_ptr<
// configure redirect ports properly, etc.
{
- Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
-
if (configure_processors_unlocked (err)) {
pstate.restore ();
configure_processors_unlocked (0); // it worked before we tried to add it ...
@@ -1117,6 +1116,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor>
{
Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this);
+ Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
for (ProcessorList::const_iterator i = others.begin(); i != others.end(); ++i) {
@@ -1137,8 +1137,8 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor>
(*i)->activate ();
}
+ /* Think: does this really need to be called for every processor in the loop? */
{
- Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (configure_processors_unlocked (err)) {
pstate.restore ();
configure_processors_unlocked (0); // it worked before we tried to add it ...