summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-01-13 10:46:11 +0100
committerRobin Gareus <robin@gareus.org>2014-01-13 10:46:11 +0100
commit35ab234e5e1aa6bbdcc095c87dfcc316e3aeb3c4 (patch)
tree6673b730fb2d6846185e8ba3d50ede4fb13e532b /libs/ardour
parenta08e7c00165d478387b279dcb219c3113d58d8df (diff)
fix deadlock when removing monitoring-section
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/route.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 842ce5e7e1..9f18d8da00 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -1377,7 +1377,7 @@ Route::clear_processors (Placement p)
}
int
-Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStreams* err, bool)
+Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStreams* err, bool need_process_lock)
{
// TODO once the export point can be configured properly, do something smarter here
if (processor == _capturing_processor) {
@@ -1397,7 +1397,10 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
processor_max_streams.reset();
{
- Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock (), Glib::Threads::NOT_LOCK);
+ if (need_process_lock) {
+ lx.acquire();
+ }
Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this);
@@ -1457,6 +1460,9 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
}
}
}
+ if (need_process_lock) {
+ lx.release();
+ }
}
reset_instrument_info ();
@@ -4147,8 +4153,7 @@ Route::has_external_redirects () const
boost::shared_ptr<Processor>
Route::the_instrument () const
{
- Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
- Glib::Threads::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
return the_instrument_unlocked ();
}