summaryrefslogtreecommitdiff
path: root/libs/ardour/session_transport.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2018-11-28 21:41:08 +0100
committerRobin Gareus <robin@gareus.org>2018-11-28 21:41:30 +0100
commitdfbda9e0f6d5003ba2ba05b21c6045f4ad1109fa (patch)
tree84b356e07849792e46cb88702936cd92151041ba /libs/ardour/session_transport.cc
parent076e9fddd4ece79b3b7de9ca0aa5283c9badbb47 (diff)
Fix a potential memory-corruption
Disk-writer run() can concurrently use the ringbuffer after it was free()ed by the butler thread.
Diffstat (limited to 'libs/ardour/session_transport.cc')
-rw-r--r--libs/ardour/session_transport.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index cc46cffad9..49354dad60 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -492,6 +492,9 @@ Session::butler_transport_work ()
}
if (ptw & PostTransportAdjustCaptureBuffering) {
+ /* need to prevent concurrency with ARDOUR::DiskWriter::run(),
+ * DiskWriter::adjust_buffering() re-allocates the ringbuffer */
+ Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {