[APU] Only set the work event/wait on the worker thread when they actually exist.

This commit is contained in:
gibbed 2019-08-04 00:49:32 -05:00
parent 38a6d110e7
commit 53b564c1a6
1 changed files with 9 additions and 4 deletions

View File

@ -175,15 +175,20 @@ void XmaDecoder::WorkerThreadMain() {
void XmaDecoder::Shutdown() {
worker_running_ = false;
work_event_->Set();
if (work_event_) {
work_event_->Set();
}
if (paused_) {
Resume();
}
// Wait for work thread.
xe::threading::Wait(worker_thread_->thread(), false);
worker_thread_.reset();
if (worker_thread_) {
// Wait for work thread.
xe::threading::Wait(worker_thread_->thread(), false);
worker_thread_.reset();
}
if (context_data_first_ptr_) {
memory()->SystemHeapFree(context_data_first_ptr_);