1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Fix music memleaks

This commit is contained in:
Mathieu Schroeter 2017-11-26 22:21:37 +01:00
parent 579a74000c
commit a1b5e5c76f

View File

@ -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)
{