mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-23 15:16:25 +01:00
fix crash in butler when destroying before thread is started
This commit is contained in:
parent
8b2f9b8aa1
commit
390c74457e
2 changed files with 8 additions and 4 deletions
|
|
@ -76,6 +76,7 @@ class LIBARDOUR_API Butler : public SessionHandleRef
|
||||||
};
|
};
|
||||||
|
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
|
bool have_thread;
|
||||||
Glib::Threads::Mutex request_lock;
|
Glib::Threads::Mutex request_lock;
|
||||||
Glib::Threads::Cond paused;
|
Glib::Threads::Cond paused;
|
||||||
bool should_run;
|
bool should_run;
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ namespace ARDOUR {
|
||||||
Butler::Butler(Session& s)
|
Butler::Butler(Session& s)
|
||||||
: SessionHandleRef (s)
|
: SessionHandleRef (s)
|
||||||
, thread()
|
, thread()
|
||||||
|
, have_thread (false)
|
||||||
, audio_dstream_capture_buffer_size(0)
|
, audio_dstream_capture_buffer_size(0)
|
||||||
, audio_dstream_playback_buffer_size(0)
|
, audio_dstream_playback_buffer_size(0)
|
||||||
, midi_dstream_buffer_size(0)
|
, midi_dstream_buffer_size(0)
|
||||||
|
|
@ -126,16 +127,18 @@ Butler::start_thread()
|
||||||
}
|
}
|
||||||
|
|
||||||
//pthread_detach (thread);
|
//pthread_detach (thread);
|
||||||
|
have_thread = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Butler::terminate_thread ()
|
Butler::terminate_thread ()
|
||||||
{
|
{
|
||||||
void* status;
|
if (have_thread) {
|
||||||
queue_request (Request::Quit);
|
void* status;
|
||||||
pthread_join (thread, &status);
|
queue_request (Request::Quit);
|
||||||
|
pthread_join (thread, &status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue