summaryrefslogtreecommitdiff
path: root/gtk2_ardour/strip_silence_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-11-23 01:00:37 +0000
committerCarl Hetherington <carl@carlh.net>2010-11-23 01:00:37 +0000
commit313da7822abf94176e40baab7cceeb9ed8e0c26b (patch)
treedd470b2057100c4e4f200f2b79091d3db11570e0 /gtk2_ardour/strip_silence_dialog.cc
parent595c7c4411eafc163be38235e1979045527460c3 (diff)
Fix hang on closing the dialogue in some circumstances. Further fix for #3560.
git-svn-id: svn://localhost/ardour2/branches/3.0@8071 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/strip_silence_dialog.cc')
-rw-r--r--gtk2_ardour/strip_silence_dialog.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/gtk2_ardour/strip_silence_dialog.cc b/gtk2_ardour/strip_silence_dialog.cc
index 48b69901e7..c43a962e4d 100644
--- a/gtk2_ardour/strip_silence_dialog.cc
+++ b/gtk2_ardour/strip_silence_dialog.cc
@@ -52,6 +52,7 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<boost::shared_ptr<ARDOU
, _wave_width (640)
, _wave_height (64)
, _peaks_ready_connection (0)
+ , _destroying (false)
{
set_session (s);
@@ -151,13 +152,15 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<boost::shared_ptr<ARDOU
StripSilenceDialog::~StripSilenceDialog ()
{
+ _destroying = true;
+
/* Terminate our thread */
_lock.lock ();
_interthread_info.cancel = true;
_thread_should_finish = true;
_lock.unlock ();
-
+
_run_cond.signal ();
pthread_join (_thread, 0);
@@ -408,6 +411,15 @@ StripSilenceDialog::detection_thread_work ()
void
StripSilenceDialog::restart_thread ()
{
+ if (_destroying) {
+ /* I don't know how this happens, but it seems to be possible for this
+ method to be called after our destructor has finished executing.
+ If this happens, bad things follow; _lock cannot be locked and
+ Ardour hangs. So if we are destroying, just bail early.
+ */
+ return;
+ }
+
/* Cancel any current run */
_interthread_info.cancel = true;