From 0f7c14085321a54ad8c442041d3a26f5dfed5fd1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 18 Sep 2017 18:01:48 +0300 Subject: Free music from cache after music disabled or on exit. --- src/soundmanager.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/soundmanager.cpp b/src/soundmanager.cpp index 9a325b7b6..a3b5149e0 100644 --- a/src/soundmanager.cpp +++ b/src/soundmanager.cpp @@ -40,6 +40,8 @@ #include "resources/loaders/musicloader.h" #include "resources/loaders/soundloader.h" +#include "resources/resourcemanager/resourcemanager.h" + #include "utils/checkutils.h" PRAGMA48(GCC diagnostic push) @@ -530,7 +532,14 @@ void SoundManager::close() if (!mInstalled) return; - haltMusic(); + if (mMusic != nullptr) + { + Mix_HaltMusic(); + ResourceManager::decRefDelete(mMusic); + mMusic = nullptr; + mCurrentMusicFile.clear(); + } + logger->log1("SoundManager::close() Shutting down sound..."); Mix_CloseAudio(); -- cgit v1.2.3-70-g09d2