From dfbda9e0f6d5003ba2ba05b21c6045f4ad1109fa Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 28 Nov 2018 21:41:08 +0100 Subject: [PATCH] Fix a potential memory-corruption Disk-writer run() can concurrently use the ringbuffer after it was free()ed by the butler thread. --- libs/ardour/session_transport.cc | 3 +++ 1 file changed, 3 insertions(+) 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 tr = boost::dynamic_pointer_cast (*i); if (tr) { -- 2.30.2