[planetblupi] 05/19: Fix music memleaks

Didier Raboud odyx at moszumanska.debian.org
Fri Dec 8 09:03:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository planetblupi.

commit a1b5e5c76f02934a97068d785cbd334f7f955207
Author: Mathieu Schroeter <mathieu at schroetersa.ch>
Date:   Sun Nov 26 22:21:37 2017 +0100

    Fix music memleaks
---
 src/sound.cxx | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/sound.cxx b/src/sound.cxx
index 7040dee..b0f46a2 100644
--- a/src/sound.cxx
+++ b/src/sound.cxx
@@ -84,6 +84,13 @@ CSound::~CSound ()
     Mix_FreeChunk (m_lpSDL[i]);
     m_lpSDL[i] = nullptr;
   }
+
+  if (m_pMusic)
+  {
+    Mix_HaltMusic ();
+    Mix_FreeMusic (m_pMusic);
+    m_pMusic = nullptr;
+  }
 }
 
 // Initialisation de DirectSound.
@@ -328,6 +335,12 @@ CSound::PlayMusic (const std::string & lpszMIDIFilename)
 
   path += lpszMIDIFilename;
 
+  if (m_pMusic)
+  {
+    Mix_HaltMusic ();
+    Mix_FreeMusic (m_pMusic);
+  }
+
   m_pMusic = Mix_LoadMUS (path.c_str ());
   if (!m_pMusic)
   {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/planetblupi.git



More information about the Pkg-games-commits mailing list