- 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 committed by drfrag
parent fbe696935d
commit 9b2054ad4d

View file

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