Bugfix: invalid memory references when cleaning up.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2420 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2008-11-08 00:50:40 +00:00
parent 0579052bc0
commit 4bcdd1c1d7

View File

@ -114,8 +114,12 @@ ItemManager::~ItemManager()
{
for(CI_type i=m_all_models.begin(); i!=m_all_models.end(); ++i)
{
ssgDeRefDelete(i->second);
// We can't use ssgDeRefDelete here, since then the object would be
// freed, and when m_all_models is deleted, we have invalid memory
// accesses.
i->second->deRef();
}
m_all_models.clear();
} // ~ItemManager
//-----------------------------------------------------------------------------