Fix crash on CloseAudioDevice: uninit device before mutex
On Android (AAudio) the callback thread could still run when the mutex was destroyed, causing a SIGABRT (pthread_mutex_lock on a destroyed mutex). Uninit the device first so its callback thread stops before ma_mutex_uninit.
This commit is contained in:
parent
a55d49b754
commit
9b9c347365
1 changed files with 2 additions and 1 deletions
|
|
@ -533,8 +533,9 @@ void CloseAudioDevice(void)
|
||||||
{
|
{
|
||||||
if (AUDIO.System.isReady)
|
if (AUDIO.System.isReady)
|
||||||
{
|
{
|
||||||
ma_mutex_uninit(&AUDIO.System.lock);
|
// Stop the device first (joins the callback thread) before destroying the mutex it locks
|
||||||
ma_device_uninit(&AUDIO.System.device);
|
ma_device_uninit(&AUDIO.System.device);
|
||||||
|
ma_mutex_uninit(&AUDIO.System.lock);
|
||||||
ma_context_uninit(&AUDIO.System.context);
|
ma_context_uninit(&AUDIO.System.context);
|
||||||
|
|
||||||
AUDIO.System.isReady = false;
|
AUDIO.System.isReady = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue