From f06d04c174e4ef4226384776746c156bd6f54c88 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 25 Apr 2022 19:03:06 -0600 Subject: [PATCH] audiosource: lock held during peak reading must be a write lock We modify elements of the source object, not to mention the peakfiles on disk. This was a regression introduced when switching from Lock to RWLock, caused by a failure to recognize this as a case where a write lock was required. The presence of scoped_array<> as a member of AudioSource (peak_cache) is suspicious nevertheless, and we should establish that it serves a useful purpose. --- libs/ardour/audiosource.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 643c648e96..587d715a96 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -762,7 +762,7 @@ AudioSource::build_peaks_from_scratch () { /* hold lock while building peaks */ - ReaderLock lp (_lock); + WriterLock lp (_lock); if (prepare_for_peakfile_writes ()) { goto out;