Fixed some minor memory leaks, added 'FIXME LEAK' comments

in many places which are either more complicated to fix for now,
or will be redesigned with irrlicht (and should therefore go
away anyway).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2996 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2009-01-20 04:26:24 +00:00
parent 389454181c
commit a24273abfc
11 changed files with 24 additions and 10 deletions

View File

@ -39,6 +39,9 @@ Explosion::Explosion(const Vec3& coord, const int explosion_sound) : ssgTransfor
//-----------------------------------------------------------------------------
Explosion::~Explosion()
{
// FIXME LEAK: Explosion that are still playing when a race ends might
// not get freed correctly (ssgCutout is removed when removing this
// from the scene node).
sfx_manager->deleteSFX(m_explode_sound);
// cut will be cleaned up when the explosion is rerefed by plib
}

View File

@ -33,6 +33,7 @@ ParticleSystem::ParticleSystem ( int num, float create_rate, int ttf, float sz)
new ssgTexCoordArray(num*4, new sgVec2[num*4] ),
new ssgColourArray (num*4, new sgVec4[num*4] )
)
//FIXME LEAK: these arrays are never freed!
{
#ifdef DEBUG
setName("particle-system");

View File

@ -852,6 +852,14 @@ void RaceGUI::drawStatusText(const float dt)
20, 20, 200 -i*20, COLORS );
}
}
float split_screen_ratio_x, split_screen_ratio_y;
split_screen_ratio_x = split_screen_ratio_y = 1.0;
if(race_manager->getNumLocalPlayers() >= 2)
split_screen_ratio_y = 0.5;
if(race_manager->getNumLocalPlayers() >= 3)
split_screen_ratio_x = 0.5;
// The penalty message needs to be displayed for up to one second
// after the start of the race, otherwise it disappears if
// "Go" is displayed and the race starts
@ -862,6 +870,7 @@ void RaceGUI::drawStatusText(const float dt)
if(RaceManager::getWorld()->getLocalPlayerKart(i)->earlyStartPenalty())
{
GLfloat const COLORS[] = { 0.78f, 0.025f, 0.025f, 1.0f };
font_race->PrintShadow( _("Penalty time!!"), 80,
Font::CENTER_OF_SCREEN, 200,
COLORS );
@ -869,12 +878,6 @@ void RaceGUI::drawStatusText(const float dt)
} // for i < getNumPlayers
} // if not RACE_PHASE
float split_screen_ratio_x, split_screen_ratio_y;
split_screen_ratio_x = split_screen_ratio_y = 1.0;
if(race_manager->getNumLocalPlayers() >= 2)
split_screen_ratio_y = 0.5;
if(race_manager->getNumLocalPlayers() >= 3)
split_screen_ratio_x = 0.5;
if ( RaceManager::getWorld()->isRacePhase() )
{

View File

@ -66,6 +66,8 @@ void AttachmentManager::loadModels()
{
for(int i=0; iat[i].attachment!=ATTACH_MAX; i++)
{
// FIXME LEAK: these models are not removed (unimportant, since they
// have to be in memory till the end of the game.
m_attachments[iat[i].attachment]=loader->load(iat[i].file, CB_ATTACHMENT);
m_attachments[iat[i].attachment]->ref();
} // for

View File

@ -146,6 +146,7 @@ void ItemManager::loadDefaultItems()
} // for i
// FIXME LEAK: these can be deleted
// Load the old, internal only models
// ----------------------------------
sgVec3 yellow = { 1.0f, 1.0f, 0.4f }; createDefaultItem(yellow, "OLD_GOLD" );

View File

@ -125,6 +125,8 @@ void PowerupManager::LoadNode(const lisp::Lisp* lisp, int collectType )
if(sModel!="")
{
// FIXME LEAK: not freed (uniportant, since the models have to exist
// for the whole game anyway).
ssgEntity* e = loader->load(sModel, CB_COLLECTABLE);
m_all_models[collectType] = e;
e->ref();

View File

@ -42,7 +42,7 @@ Moveable::~Moveable()
// The body is being removed from the world in kart/projectile
if(m_body) delete m_body;
if(m_motion_state) delete m_motion_state;
// FIXME what about model?
// FIXME LEAK: what about model? ssgDeRefDelete(m_model_transform)
} // ~Moveable
//-----------------------------------------------------------------------------

View File

@ -504,6 +504,7 @@ void CleanTuxKart()
if(loader) delete loader;
if(translations) delete translations;
if(file_manager) delete file_manager;
if(scene) delete scene;
}
//=============================================================================

View File

@ -38,8 +38,7 @@
Scene *scene = 0;
Scene::Scene() :
m_scenegraph(new ssgRoot)
Scene::Scene() : m_scenegraph(new ssgRoot)
{
}

View File

@ -352,6 +352,7 @@ SDLDriver::~SDLDriver()
delete [] m_stick_infos;
// FIXME LEAK: delete m_action_map if defined
SDL_FreeSurface(m_main_surface);
SDL_Quit();

View File

@ -49,7 +49,8 @@ ssgTransform* createShadow( const std::string& name,
result -> setName ( "Shadow" ) ;
ssgVtxTable *gs = new ssgVtxTable ( GL_TRIANGLE_STRIP, va, na, ta, ca ) ;
// FIXME LEAK: va, na, ta, and ca are most likely leaked, since plib
// will mark them as 'not owned' and therefore not free them!
gs -> clrTraversalMaskBits ( SSGTRAV_ISECT|SSGTRAV_HOT ) ;
gs -> setState ( material_manager->getMaterial ( name.c_str() ) -> getState () ) ;