Skip to content

Commit

Permalink
fix some very minor memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Jun 30, 2015
1 parent 580b610 commit 732e5b8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/PowderToySDL.cpp
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/debug/DebugInfo.h
Expand Up @@ -6,6 +6,7 @@ class DebugInfo
{
public:
DebugInfo(unsigned int id):ID(id) { }
virtual ~DebugInfo() { }
unsigned int ID;
virtual void Draw() {}
};
4 changes: 4 additions & 0 deletions src/gui/game/GameController.cpp
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/gui/game/QuickOption.h
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/simulation/Gravity.cpp
Expand Up @@ -60,6 +60,7 @@ void Gravity::gravity_init()

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

0 comments on commit 732e5b8

Please sign in to comment.