From c5cc1870f3ec0d9b6499b04b4ab2123bcf58db84 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Wed, 25 Jan 2012 18:42:35 +0000 Subject: Fix some memory leaks diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 9d6076f..4226483 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -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(); diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index d7c9633..85518f7 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -118,7 +118,7 @@ void GameController::DrawPoints(queue & pointQueue) void GameController::Tick() { - gameModel->GetSimulation()->update_particles(); + //gameModel->GetSimulation()->update_particles(); } void GameController::SetPaused(bool pauseState) diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 8062c64..33eb143 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -54,6 +54,8 @@ GameModel::~GameModel() } delete sim; delete ren; + if(activeTool) + delete activeTool; } Brush * GameModel::GetBrush() diff --git a/src/login/LoginController.cpp b/src/login/LoginController.cpp index 5a81a55..a3162be 100644 --- a/src/login/LoginController.cpp +++ b/src/login/LoginController.cpp @@ -35,7 +35,6 @@ void LoginController::Exit() if(ui::Engine::Ref().GetWindow() == loginView) { ui::Engine::Ref().CloseWindow(); - loginView = NULL; } if(callback) callback->ControllerExit(); diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 61d8ae7..243b903 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -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(); } -- cgit v0.9.2-21-gd62e