Fixed race condition where XMP voices could be played by the audio driver thread before they were fully initialized or fully freed

git-svn-id: https://svn.eduke32.com/eduke32@6564 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2017-12-17 02:03:52 +00:00
parent bcb41aac3e
commit efaf328e4d

View file

@ -157,6 +157,9 @@ int32_t MV_PlayXMP(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
xmpd->owner = voice;
voice->length = 0;
voice->sound = 0;
voice->wavetype = FMT_XMP;
voice->rawdataptr = (void*)xmpd;
voice->GetSound = MV_GetNextXMPBlock;
@ -199,12 +202,12 @@ void MV_ReleaseXMPVoice(VoiceNode * voice)
if (voice->wavetype != FMT_XMP)
return;
voice->rawdataptr = 0;
xmp_end_player(xmpd->context);
xmp_release_module(xmpd->context);
xmp_free_context(xmpd->context);
free(xmpd);
voice->rawdataptr = 0;
}
#else