From e161bc0596b6cb8facdefc56435553f76ee643c3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 6 Sep 2015 12:39:53 +0200 Subject: [PATCH] fix peak-thread, GUI-thread race condition --- gtk2_ardour/audio_region_view.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 4f963a290d..bbee73c115 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -1125,6 +1125,14 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/) { //cerr << "AudioRegionView::create_one_wave() called which: " << which << " this: " << this << endl;//DEBUG RouteTimeAxisView& atv (*(dynamic_cast(&trackview))); // ick + if (!trackview.session() || trackview.session()->deletion_in_progress () || !atv.track()) { + /* peaks_ready_handler() may be called from peak_thread_work() while + * session deletion is in progress. + * Since session-unload happens in the GUI thread, we need to test + * in this context. + */ + return; + } uint32_t nchans = atv.track()->n_channels().n_audio(); uint32_t n; uint32_t nwaves = std::min (nchans, audio_region()->n_channels());