diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-09-18 18:01:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-09-18 18:01:48 +0300 |
commit | 0f7c14085321a54ad8c442041d3a26f5dfed5fd1 (patch) | |
tree | b942189612a7c95301232853cfbc8562b9b60688 /src | |
parent | b6d83c911a9a11876f60e1c63181f093d98a37ba (diff) | |
download | manaverse-0f7c14085321a54ad8c442041d3a26f5dfed5fd1.tar.gz manaverse-0f7c14085321a54ad8c442041d3a26f5dfed5fd1.tar.bz2 manaverse-0f7c14085321a54ad8c442041d3a26f5dfed5fd1.tar.xz manaverse-0f7c14085321a54ad8c442041d3a26f5dfed5fd1.zip |
Free music from cache after music disabled or on exit.
Diffstat (limited to 'src')
-rw-r--r-- | src/soundmanager.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
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(); |