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:
parent
579a74000c
commit
a1b5e5c76f
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user