From a29a3b81f3eb88b641dc6fce463b248bbd964f0d Mon Sep 17 00:00:00 2001 From: David Reid Date: Mon, 5 Jan 2026 16:47:11 +1000 Subject: [PATCH] Fix a crash when uninitializing a device in single-threaded mode. --- miniaudio.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/miniaudio.h b/miniaudio.h index 1589bd89..8c9bbbbc 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -45400,16 +45400,15 @@ MA_API void ma_device_uninit(ma_device* pDevice) need to wait for the operation to complete. We can just wait for the thread instead. */ #ifndef MA_NO_THREADING - { + if (pDevice->hasAudioThread) { ma_device_op_queue_push(&pDevice->opQueue, MA_DEVICE_OP_UNINIT, NULL, NULL); ma_thread_wait(&pDevice->audioThread); - } - #else + } else + #endif { /* Not using threading. */ ma_device_op_do_uninit(pDevice, NULL); } - #endif if (pDevice->type == ma_device_type_duplex) { ma_duplex_rb_uninit(&pDevice->duplexRB);