diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index aceb0d7036..73dae08c42 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -135,7 +135,10 @@ AudioSource::~AudioSource () void AudioSource::estimate_tempo () { +#ifndef NDEBUG /* CALLER MUST HOLD WRITER LOCK */ + assert (!_lock.writer_trylock()); +#endif const samplecnt_t ten_seconds = _session.sample_rate() * 10; diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 1e316ad4d2..d5c19635f5 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -259,7 +259,10 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path, throw failed_constructor (); } ret->check_for_analysis_data_on_disk (); - src->estimate_tempo (); + { + Source::WriterLock lm (src->mutex ()); + src->estimate_tempo (); + } if (announce) { SourceCreated (ret); } @@ -276,7 +279,10 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path, throw failed_constructor (); } ret->check_for_analysis_data_on_disk (); - src->estimate_tempo (); + { + Source::WriterLock lm (src->mutex ()); + src->estimate_tempo (); + } if (announce) { SourceCreated (ret); } @@ -425,7 +431,10 @@ SourceFactory::createFromPlaylist (DataType type, Session& s, std::shared_ptrcheck_for_analysis_data_on_disk (); - src->estimate_tempo (); + { + Source::WriterLock lm (src->mutex ()); + src->estimate_tempo (); + } SourceCreated (ret); return ret; }