Fix some memory leaks

This commit is contained in:
Simon Robertshaw 2012-01-25 18:42:35 +00:00
parent 8b80942b16
commit c5cc1870f3
5 changed files with 11 additions and 2 deletions

View File

@ -1682,6 +1682,9 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
this->g = g;
this->sim = sim;
memset(fire_r, 0, sizeof(fire_r));
memset(fire_g, 0, sizeof(fire_g));
memset(fire_b, 0, sizeof(fire_b));
prepare_alpha(CELL, 1.0f);
init_display_modes();
prepare_graphicscache();

View File

@ -118,7 +118,7 @@ void GameController::DrawPoints(queue<ui::Point*> & pointQueue)
void GameController::Tick()
{
gameModel->GetSimulation()->update_particles();
//gameModel->GetSimulation()->update_particles();
}
void GameController::SetPaused(bool pauseState)

View File

@ -54,6 +54,8 @@ GameModel::~GameModel()
}
delete sim;
delete ren;
if(activeTool)
delete activeTool;
}
Brush * GameModel::GetBrush()

View File

@ -35,7 +35,6 @@ void LoginController::Exit()
if(ui::Engine::Ref().GetWindow() == loginView)
{
ui::Engine::Ref().CloseWindow();
loginView = NULL;
}
if(callback)
callback->ControllerExit();

View File

@ -3185,18 +3185,23 @@ Simulation::Simulation():
int menuCount;
menu_section * msectionsT = LoadMenus(menuCount);
memcpy(msections, msectionsT, menuCount * sizeof(menu_section));
free(msectionsT);
int wallCount;
wall_type * wtypesT = LoadWalls(wallCount);
memcpy(wtypes, wtypesT, wallCount * sizeof(wall_type));
free(wtypesT);
int elementCount;
part_type * ptypesT = LoadElements(elementCount);
memcpy(ptypes, ptypesT, elementCount * sizeof(part_type));
free(ptypesT);
int transitionCount;
part_transition * ptransitionsT = LoadTransitions(transitionCount);
memcpy(ptransitions, ptransitionsT, sizeof(part_transition) * transitionCount);
free(ptransitionsT);
init_can_move();
clear_sim();
}