fix even more memory leaks

This commit is contained in:
jacob1 2013-02-24 19:11:37 -05:00
parent b92bd245c8
commit fbf52794e5
8 changed files with 42 additions and 5 deletions

View File

@ -188,6 +188,10 @@ GameController::~GameController()
{
delete localBrowser;
}
if (options)
{
delete options;
}
if(ui::Engine::Ref().GetWindow() == gameView)
{
ui::Engine::Ref().CloseWindow();

View File

@ -179,6 +179,10 @@ GameModel::~GameModel()
{
delete *iter;
}
for(std::vector<QuickOption*>::iterator iter = quickOptions.begin(), end = quickOptions.end(); iter != end; ++iter)
{
delete *iter;
}
delete sim;
delete ren;
if(placeSave)

View File

@ -22,6 +22,7 @@ void ToolButton::OnMouseClick(int x, int y, unsigned int button)
void ToolButton::OnMouseUnclick(int x, int y, unsigned int button)
{
isButtonDown = false;
if(isButtonDown)
{
if(button == BUTTON_LEFT)
@ -32,7 +33,6 @@ void ToolButton::OnMouseUnclick(int x, int y, unsigned int button)
SetSelectionState(2);
DoAction();
}
isButtonDown = false;
}
void ToolButton::Draw(const ui::Point& screenPos)

View File

@ -46,6 +46,8 @@ Engine::~Engine()
delete windows.top();
windows.pop();
}
if (lastBuffer)
free(lastBuffer);
}
void Engine::Begin(int width, int height)

View File

@ -316,5 +316,11 @@ void PreviewModel::Update()
PreviewModel::~PreviewModel() {
if(save)
delete save;
if(saveComments)
{
for(int i = 0; i < saveComments->size(); i++)
delete saveComments->at(i);
delete saveComments;
}
}

View File

@ -411,7 +411,7 @@ void PreviewView::NotifySaveChanged(PreviewModel * sender)
float factorY = ((float)YRES/2)/((float)savePreview->Size.Y);
float scaleFactor = factorY < factorX ? factorY : factorX;
savePreview->Data = Graphics::resample_img(oldData, savePreview->Size.X, savePreview->Size.Y, savePreview->Size.X*scaleFactor, savePreview->Size.Y*scaleFactor);
delete oldData;
delete[] oldData;
savePreview->Size.X *= scaleFactor;
savePreview->Size.Y *= scaleFactor;
}
@ -453,14 +453,14 @@ void PreviewView::NotifyCommentBoxEnabledChanged(PreviewModel * sender)
if(addCommentBox)
{
RemoveComponent(addCommentBox);
addCommentBox = NULL;
delete addCommentBox;
addCommentBox = NULL;
}
if(submitCommentButton)
{
RemoveComponent(submitCommentButton);
submitCommentButton = NULL;
delete submitCommentButton;
submitCommentButton = NULL;
}
if(sender->GetCommentBoxEnabled())
{
@ -561,6 +561,17 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
}
}*/
PreviewView::~PreviewView() {
PreviewView::~PreviewView()
{
if(addCommentBox)
{
RemoveComponent(addCommentBox);
delete addCommentBox;
}
if(submitCommentButton)
{
RemoveComponent(submitCommentButton);
delete submitCommentButton;
}
}

View File

@ -88,6 +88,8 @@ void SearchController::Exit()
}
if(callback)
callback->ControllerExit();
delete callback;
callback = NULL;
//HasExited = true;
}
@ -101,6 +103,7 @@ SearchController::~SearchController()
}
delete searchModel;
delete searchView;
delete callback;
}
void SearchController::DoSearch(std::string query, bool now)

View File

@ -252,6 +252,13 @@ SearchView::~SearchView()
RemoveComponent(previousButton);
RemoveComponent(infoLabel);
for(int i = 0; i < saveButtons.size(); i++)
{
RemoveComponent(saveButtons[i]);
delete saveButtons[i];
}
saveButtons.clear();
delete nextButton;
delete previousButton;
delete infoLabel;