diff options
author | Carl Hetherington <carl@carlh.net> | 2012-03-25 20:30:26 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-03-25 20:30:26 +0000 |
commit | ca1de500041e2739cf623bc94b090ff82ee6052c (patch) | |
tree | 9879ef7815de3e47a993d9cb82986577d543d44f /libs/ardour/internal_return.cc | |
parent | e7d2509ad9a40a4f75856b620cd366df6e454216 (diff) |
Give the _sends member of InternalReturn its own mutex,
rather than using the process lock to protect it. Prevents
a deadlock when removing an aux send causes it to remove
itself from its return (#4712).
git-svn-id: svn://localhost/ardour2/branches/3.0@11760 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/internal_return.cc')
-rw-r--r-- | libs/ardour/internal_return.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc index 3c75c7957d..6a3d20e5c9 100644 --- a/libs/ardour/internal_return.cc +++ b/libs/ardour/internal_return.cc @@ -43,11 +43,13 @@ InternalReturn::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*e return; } - /* _sends is only modified with the process lock held, so this is ok, I think */ - - for (list<InternalSend*>::iterator i = _sends.begin(); i != _sends.end(); ++i) { - if ((*i)->active ()) { - bufs.merge_from ((*i)->get_buffers(), nframes); + Glib::Mutex::Lock lm (_sends_mutex, Glib::TRY_LOCK); + + if (lm.locked ()) { + for (list<InternalSend*>::iterator i = _sends.begin(); i != _sends.end(); ++i) { + if ((*i)->active ()) { + bufs.merge_from ((*i)->get_buffers(), nframes); + } } } @@ -57,18 +59,14 @@ InternalReturn::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*e void InternalReturn::add_send (InternalSend* send) { - /* caller must hold process lock */ - assert (!AudioEngine::instance()->process_lock().trylock()); - + Glib::Mutex::Lock lm (_sends_mutex); _sends.push_back (send); } void InternalReturn::remove_send (InternalSend* send) { - /* caller must hold process lock */ - assert (!AudioEngine::instance()->process_lock().trylock()); - + Glib::Mutex::Lock lm (_sends_mutex); _sends.remove (send); } |