Changed: Delete SoundMngr to avoid memory leaks

This commit is contained in:
kervala 2016-05-17 10:59:28 +02:00
parent c57fab9280
commit 46b72b622f
4 changed files with 7 additions and 5 deletions

View file

@ -1555,7 +1555,8 @@ void postlogInit()
{ {
nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); nlwarning("init : Error when creating 'SoundMngr' : %s", e.what());
// leak the alocated sound manager... // leak the alocated sound manager...
SoundMngr = 0; delete SoundMngr;
SoundMngr = NULL;
} }
// Play Music just after the SoundMngr is inited // Play Music just after the SoundMngr is inited

View file

@ -329,7 +329,8 @@ void updateFromClientCfg()
catch(const Exception &e) catch(const Exception &e)
{ {
nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); nlwarning("init : Error when creating 'SoundMngr' : %s", e.what());
SoundMngr = 0; delete SoundMngr;
SoundMngr = NULL;
} }
// re-init with good SFX/Music Volume // re-init with good SFX/Music Volume

View file

@ -478,7 +478,7 @@ void releaseOutGame()
if(SoundMngr) if(SoundMngr)
{ {
delete SoundMngr; delete SoundMngr;
SoundMngr = 0; SoundMngr = NULL;
} }
// Delete the driver. // Delete the driver.
@ -573,7 +573,7 @@ void release()
if(SoundMngr) if(SoundMngr)
{ {
delete SoundMngr; delete SoundMngr;
SoundMngr = 0; SoundMngr = NULL;
} }
// Release the Entities Animation Manager // Release the Entities Animation Manager

View file

@ -2381,7 +2381,7 @@ void CUserEntity::updateSound(const TTime &time)
H_AUTO_USE ( RZ_Client_Update_Sound ); H_AUTO_USE ( RZ_Client_Update_Sound );
// no sound manager, no need to update sound // no sound manager, no need to update sound
if (SoundMngr == 0) if (SoundMngr == NULL)
return; return;
if (!(StereoHMD && true)) // TODO: ClientCfg.Headphone if (!(StereoHMD && true)) // TODO: ClientCfg.Headphone