mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 12:46:32 +01:00
Prevent crash at session-close when analysing.
The Analyser only holds a weak-pointer the the Source, session-destruction frees the actual Source, which is fatal for any ongoing audio analysis. This fix simply waits for the current ongoing analysis to complete, ideally TransientDetector::run, EBUr128Analysis::run, OnsetDetector::run and AudioAnalyser::analyse could be interrupted. Alternate option: cancel the Analyser::work thread (and re-create with the every session).
This commit is contained in:
parent
ff62cec27d
commit
71520c7432
3 changed files with 16 additions and 2 deletions
|
|
@ -31,6 +31,7 @@ using namespace ARDOUR;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
|
|
||||||
Analyser* Analyser::the_analyser = 0;
|
Analyser* Analyser::the_analyser = 0;
|
||||||
|
Glib::Threads::Mutex Analyser::analysis_active_lock;
|
||||||
Glib::Threads::Mutex Analyser::analysis_queue_lock;
|
Glib::Threads::Mutex Analyser::analysis_queue_lock;
|
||||||
Glib::Threads::Cond Analyser::SourcesToAnalyse;
|
Glib::Threads::Cond Analyser::SourcesToAnalyse;
|
||||||
list<boost::weak_ptr<Source> > Analyser::analysis_queue;
|
list<boost::weak_ptr<Source> > Analyser::analysis_queue;
|
||||||
|
|
@ -96,6 +97,7 @@ Analyser::work ()
|
||||||
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
|
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
|
||||||
|
|
||||||
if (afs && afs->length(afs->timeline_position())) {
|
if (afs && afs->length(afs->timeline_position())) {
|
||||||
|
Glib::Threads::Mutex::Lock lm (analysis_active_lock);
|
||||||
analyse_audio_file_source (afs);
|
analyse_audio_file_source (afs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -119,3 +121,11 @@ Analyser::analyse_audio_file_source (boost::shared_ptr<AudioFileSource> src)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Analyser::flush ()
|
||||||
|
{
|
||||||
|
Glib::Threads::Mutex::Lock lq (analysis_queue_lock);
|
||||||
|
Glib::Threads::Mutex::Lock la (analysis_active_lock);
|
||||||
|
analysis_queue.clear();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,11 @@ class LIBARDOUR_API Analyser {
|
||||||
static void init ();
|
static void init ();
|
||||||
static void queue_source_for_analysis (boost::shared_ptr<Source>, bool force);
|
static void queue_source_for_analysis (boost::shared_ptr<Source>, bool force);
|
||||||
static void work ();
|
static void work ();
|
||||||
|
static void flush ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Analyser* the_analyser;
|
static Analyser* the_analyser;
|
||||||
|
static Glib::Threads::Mutex analysis_active_lock;
|
||||||
static Glib::Threads::Mutex analysis_queue_lock;
|
static Glib::Threads::Mutex analysis_queue_lock;
|
||||||
static Glib::Threads::Cond SourcesToAnalyse;
|
static Glib::Threads::Cond SourcesToAnalyse;
|
||||||
static std::list<boost::weak_ptr<Source> > analysis_queue;
|
static std::list<boost::weak_ptr<Source> > analysis_queue;
|
||||||
|
|
|
||||||
|
|
@ -544,6 +544,8 @@ Session::destroy ()
|
||||||
|
|
||||||
remove_pending_capture_state ();
|
remove_pending_capture_state ();
|
||||||
|
|
||||||
|
Analyser::flush ();
|
||||||
|
|
||||||
_state_of_the_state = StateOfTheState (CannotSave|Deletion);
|
_state_of_the_state = StateOfTheState (CannotSave|Deletion);
|
||||||
|
|
||||||
/* disconnect from any and all signals that we are connected to */
|
/* disconnect from any and all signals that we are connected to */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue