From 60cc91e000c3994466b568eef043afe979e2d31f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 8 May 2017 16:59:31 -0700 Subject: [PATCH] Properly unload the backend sound buffers --- src/s_sound.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/s_sound.cpp b/src/s_sound.cpp index d2a830fef..ea12fe97e 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -594,15 +594,14 @@ void S_CacheSound (sfxinfo_t *sfx) void S_UnloadSound (sfxinfo_t *sfx) { + if (sfx->data3d.isValid() && sfx->data != sfx->data3d) + GSnd->UnloadSound(sfx->data3d); if (sfx->data.isValid()) - { - if(sfx->data3d.isValid() && sfx->data != sfx->data3d) - GSnd->UnloadSound(sfx->data3d); GSnd->UnloadSound(sfx->data); - sfx->data.Clear(); - sfx->data3d.Clear(); + if (sfx->data.isValid() || sfx->data3d.isValid()) DPrintf(DMSG_NOTIFY, "Unloaded sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]); - } + sfx->data.Clear(); + sfx->data3d.Clear(); } //==========================================================================