summaryrefslogtreecommitdiff
path: root/libs/ardour/butler.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-05-01 12:27:26 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-05-01 12:31:34 -0400
commite69531b953c5fe717b88b051acd087de3caed166 (patch)
tree9dd7f4dd48176c39966ef7aaa9c0b7fed493dc87 /libs/ardour/butler.cc
parentcd004296729e50830d0c47c2734b26908508795b (diff)
fix crash in butler when destroying before thread is started
Diffstat (limited to 'libs/ardour/butler.cc')
-rw-r--r--libs/ardour/butler.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc
index c9eb55a472..327665441e 100644
--- a/libs/ardour/butler.cc
+++ b/libs/ardour/butler.cc
@@ -43,6 +43,7 @@ namespace ARDOUR {
Butler::Butler(Session& s)
: SessionHandleRef (s)
, thread()
+ , have_thread (false)
, audio_dstream_capture_buffer_size(0)
, audio_dstream_playback_buffer_size(0)
, midi_dstream_buffer_size(0)
@@ -126,16 +127,18 @@ Butler::start_thread()
}
//pthread_detach (thread);
-
+ have_thread = true;
return 0;
}
void
Butler::terminate_thread ()
{
- void* status;
- queue_request (Request::Quit);
- pthread_join (thread, &status);
+ if (have_thread) {
+ void* status;
+ queue_request (Request::Quit);
+ pthread_join (thread, &status);
+ }
}
void *