- fixed crash when exiting before sound engine initialization

https://forum.zdoom.org/viewtopic.php?t=66605
This commit is contained in:
alexey.lysiuk 2019-12-09 15:43:01 +02:00
parent 47305a740f
commit 430a6f3247
1 changed files with 8 additions and 5 deletions

View File

@ -741,10 +741,14 @@ void FPlayerSoundHashTable::MarkUsed()
void S_ClearSoundData() void S_ClearSoundData()
{ {
soundEngine->StopAllChannels(); if (soundEngine)
soundEngine->UnloadAllSounds(); {
auto &S_sfx = soundEngine->GetSounds(); soundEngine->StopAllChannels();
S_sfx.Clear(); soundEngine->UnloadAllSounds();
soundEngine->GetSounds().Clear();
soundEngine->ClearRandoms();
}
Ambients.Clear(); Ambients.Clear();
while (MusicVolumes != NULL) while (MusicVolumes != NULL)
{ {
@ -752,7 +756,6 @@ void S_ClearSoundData()
MusicVolumes = me->Next; MusicVolumes = me->Next;
M_Free(me); M_Free(me);
} }
soundEngine->ClearRandoms();
NumPlayerReserves = 0; NumPlayerReserves = 0;
PlayerClassesIsSorted = false; PlayerClassesIsSorted = false;