Fixed memory leak.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8385 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-04-19 22:57:52 +00:00
parent de56e96010
commit e6e0599976
2 changed files with 7 additions and 3 deletions

View File

@ -96,6 +96,7 @@ Kart::Kart (const std::string& ident, Track* track, int position, bool is_first_
m_shadow = NULL;
m_terrain_particles = NULL;
m_nitro = NULL;
m_nitro_kind = NULL;
m_slipstream = NULL;
m_skidmarks = NULL;
m_camera = NULL;
@ -377,6 +378,7 @@ Kart::~Kart()
if(m_previous_terrain_sound) sfx_manager->deleteSFX(m_previous_terrain_sound);
if(m_terrain_particles) delete m_terrain_particles;
if(m_nitro) delete m_nitro;
if(m_nitro_kind) delete m_nitro_kind;
if(m_slipstream) delete m_slipstream;
if(m_rain) delete m_rain;
if(m_sky_particles_emitter) delete m_sky_particles_emitter;
@ -1735,9 +1737,8 @@ void Kart::loadData(RaceManager::KartType type, bool is_first_kart, Track* track
try
{
m_nitro = new ParticleEmitter(
new ParticleKind(file_manager->getGfxFile("nitro.xml")),
position, getNode());
m_nitro_kind = new ParticleKind(file_manager->getGfxFile("nitro.xml"));
m_nitro = new ParticleEmitter(m_nitro_kind, position, getNode());
}
catch (std::runtime_error& e)
{

View File

@ -143,6 +143,9 @@ private:
/** Graphical effect when using a nitro. */
ParticleEmitter *m_nitro;
/** The particle kind for the nitro. */
ParticleKind *m_nitro_kind;
/** Handles all slipstreaming. */
SlipStream *m_slipstream;