Fixed crash on exit + improved error handling so that this bug, if should it occur again, will at least trigger the debugger in an appropriate way and/or give an erorr message

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4043 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-09-23 00:48:23 +00:00
parent 54cf897dc2
commit 24af33b9b9
2 changed files with 9 additions and 2 deletions

View File

@ -71,12 +71,15 @@ SFXManager::~SFXManager()
{
delete (*i);
} // for i in m_all_sfx
m_all_sfx.clear();
//the unbuffer all of the buffers
for(unsigned int ii = 0; ii != m_sfx_buffers.size(); ii++)
{
alDeleteBuffers(1, &(m_sfx_buffers[ii]));
}
sfx_manager = NULL;
} // ~SFXManager
//----------------------------------------------------------------------------
@ -352,12 +355,14 @@ void SFXManager::deleteSFX(SFXBase *sfx)
{
std::vector<SFXBase*>::iterator i;
i=std::find(m_all_sfx.begin(), m_all_sfx.end(), sfx);
delete sfx;
if(i==m_all_sfx.end())
{
fprintf(stderr, "SFXManager::deleteSFX : Warning: sfx not found in list.\n");
return;
}
delete sfx;
m_all_sfx.erase(i);

View File

@ -128,7 +128,9 @@ UnlockManager::UnlockManager()
UnlockManager::~UnlockManager()
{
save();
sfx_manager->deleteSFX(m_locked_sound);
// sfx_manager is destroyed before UnlockManager is, so SFX will be already deleted
// sfx_manager->deleteSFX(m_locked_sound);
} // ~UnlockManager
//-----------------------------------------------------------------------------