Permalink
Browse files

fix some very minor memory leaks

  • Loading branch information...
jacob1 committed Jun 30, 2015
1 parent 580b610 commit 732e5b87301f015dd1ed95529e587100b19aca20
Showing with 9 additions and 2 deletions.
  1. +1 −0 src/PowderToySDL.cpp
  2. +1 −0 src/debug/DebugInfo.h
  3. +4 −0 src/gui/game/GameController.cpp
  4. +2 −2 src/gui/game/QuickOption.h
  5. +1 −0 src/simulation/Gravity.cpp
@@ -334,6 +334,7 @@ int SDLOpen()
#elif defined(LIN)
SDL_Surface *icon = SDL_CreateRGBSurfaceFrom((void*)app_icon, 48, 48, 24, 144, 0x00FF0000, 0x0000FF00, 0x000000FF, 0);
SDL_WM_SetIcon(icon, (Uint8*)app_icon_bitmap);
SDL_FreeSurface(icon);
#endif

SDL_WM_SetCaption("The Powder Toy", "Powder Toy");
@@ -6,6 +6,7 @@ class DebugInfo
{
public:
DebugInfo(unsigned int id):ID(id) { }
virtual ~DebugInfo() { }
unsigned int ID;
virtual void Draw() {}
};
@@ -195,6 +195,10 @@ GameController::~GameController()
{
delete options;
}
for(std::vector<DebugInfo*>::iterator iter = debugInfo.begin(), end = debugInfo.end(); iter != end; iter++)
{
delete *iter;
}
//deleted here because it refuses to be deleted when deleted from gameModel even with the same code
std::deque<Snapshot*> history = gameModel->GetHistory();
for(std::deque<Snapshot*>::iterator iter = history.begin(), end = history.end(); iter != end; ++iter)
@@ -37,8 +37,8 @@ class QuickOption
public:
virtual ~QuickOption()
{
//for(std::vector<QuickOptionListener*>::iterator iter = listeners.begin(), end = listeners.end(); iter != end; ++iter)
// delete *iter;
for(std::vector<QuickOptionListener*>::iterator iter = listeners.begin(), end = listeners.end(); iter != end; ++iter)
delete *iter;
}

std::vector<QuickOptionListener*> GetListeners()
@@ -60,6 +60,7 @@ void Gravity::gravity_init()

void Gravity::gravity_cleanup()
{
stop_grav_async();
#ifdef GRAVFFT
grav_fft_cleanup();
#endif

0 comments on commit 732e5b8

Please sign in to comment.