Fixed memory leak (check_manager and therefore all check structures

were not freed).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6746 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-11-28 22:07:05 +00:00
parent 7c36638e63
commit 03ff921883
3 changed files with 17 additions and 0 deletions

View File

@ -55,6 +55,16 @@ CheckManager::CheckManager(const XMLNode &node, Track *track)
} // CheckManager } // CheckManager
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
CheckManager::~CheckManager()
{
for(unsigned int i=0; i<m_all_checks.size(); i++)
{
delete m_all_checks[i];
}
} // ~CheckManager
// ----------------------------------------------------------------------------
/** Resets all checks. */ /** Resets all checks. */
void CheckManager::reset(const Track &track) void CheckManager::reset(const Track &track)
{ {

View File

@ -36,6 +36,7 @@ private:
std::vector<CheckStructure*> m_all_checks; std::vector<CheckStructure*> m_all_checks;
public: public:
CheckManager(const XMLNode &node, Track *track); CheckManager(const XMLNode &node, Track *track);
~CheckManager();
void update(float dt); void update(float dt);
void reset(const Track &track); void reset(const Track &track);
/** Returns the nth. check structure. */ /** Returns the nth. check structure. */

View File

@ -146,6 +146,12 @@ void Track::cleanup()
m_animation_manager = NULL; m_animation_manager = NULL;
} }
if(m_check_manager)
{
delete m_check_manager;
m_check_manager=NULL;
}
delete m_track_object_manager; delete m_track_object_manager;
m_track_object_manager = NULL; m_track_object_manager = NULL;