Fix a crash when uninitializing a device in single-threaded mode.

This commit is contained in:
David Reid
2026-01-05 16:47:11 +10:00
parent d32cd3f843
commit a29a3b81f3
+3 -4
View File
@@ -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. need to wait for the operation to complete. We can just wait for the thread instead.
*/ */
#ifndef MA_NO_THREADING #ifndef MA_NO_THREADING
{ if (pDevice->hasAudioThread) {
ma_device_op_queue_push(&pDevice->opQueue, MA_DEVICE_OP_UNINIT, NULL, NULL); ma_device_op_queue_push(&pDevice->opQueue, MA_DEVICE_OP_UNINIT, NULL, NULL);
ma_thread_wait(&pDevice->audioThread); ma_thread_wait(&pDevice->audioThread);
} } else
#else #endif
{ {
/* Not using threading. */ /* Not using threading. */
ma_device_op_do_uninit(pDevice, NULL); ma_device_op_do_uninit(pDevice, NULL);
} }
#endif
if (pDevice->type == ma_device_type_duplex) { if (pDevice->type == ma_device_type_duplex) {
ma_duplex_rb_uninit(&pDevice->duplexRB); ma_duplex_rb_uninit(&pDevice->duplexRB);