Movie audio disposal bugfix

Put the audioThread check within the hasAudio conditional in the movie destructor
The order is significant, as trying to dispose of OpenAL objects before audioThread is complete can result in hanging
This commit is contained in:
Eblo 2023-10-10 21:27:15 -04:00
parent 92167bdfc9
commit 2894880550
No known key found for this signature in database
GPG key ID: 214AFBC4697F23AC

View file

@ -402,14 +402,14 @@ struct Movie
audioQueueHead = NULL;
SDL_DestroyMutex(audioMutex);
audioThreadTermReq.set();
if(audioThread) {
SDL_WaitThread(audioThread, 0);
audioThread = 0;
}
alSourceStop(audioSource);
alDeleteSources(1, &audioSource);
alDeleteBuffers(STREAM_BUFS, alBuffers);
}
if(audioThread) {
SDL_WaitThread(audioThread, 0);
audioThread = 0;
}
if (video) THEORAPLAY_freeVideo(video);
if (audio) THEORAPLAY_freeAudio(audio);
if (decoder) THEORAPLAY_stopDecode(decoder);