summaryrefslogtreecommitdiff
path: root/src/soundmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-18 18:01:48 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-18 18:01:48 +0300
commit0f7c14085321a54ad8c442041d3a26f5dfed5fd1 (patch)
treeb942189612a7c95301232853cfbc8562b9b60688 /src/soundmanager.cpp
parentb6d83c911a9a11876f60e1c63181f093d98a37ba (diff)
downloadplus-0f7c14085321a54ad8c442041d3a26f5dfed5fd1.tar.gz
plus-0f7c14085321a54ad8c442041d3a26f5dfed5fd1.tar.bz2
plus-0f7c14085321a54ad8c442041d3a26f5dfed5fd1.tar.xz
plus-0f7c14085321a54ad8c442041d3a26f5dfed5fd1.zip
Free music from cache after music disabled or on exit.
Diffstat (limited to 'src/soundmanager.cpp')
-rw-r--r--src/soundmanager.cpp11
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();