summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-02-25 00:11:37 (GMT)
committer jacob1 <jfu614@gmail.com>2013-02-25 00:11:37 (GMT)
commitfbf52794e59ede9be4362a8816e0682e41dcf414 (patch)
tree3fce05c90530469832f16648a7adf10adb95b6e9 /src
parentb92bd245c8b1311b6cd63171611e47a6468e410f (diff)
downloadpowder-fbf52794e59ede9be4362a8816e0682e41dcf414.zip
powder-fbf52794e59ede9be4362a8816e0682e41dcf414.tar.gz
fix even more memory leaks
Diffstat (limited to 'src')
-rw-r--r--src/game/GameController.cpp4
-rw-r--r--src/game/GameModel.cpp4
-rw-r--r--src/game/ToolButton.cpp2
-rw-r--r--src/interface/Engine.cpp2
-rw-r--r--src/preview/PreviewModel.cpp6
-rw-r--r--src/preview/PreviewView.cpp19
-rw-r--r--src/search/SearchController.cpp3
-rw-r--r--src/search/SearchView.cpp7
8 files changed, 42 insertions, 5 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index c866805..1e10b0e 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -188,6 +188,10 @@ GameController::~GameController()
{
delete localBrowser;
}
+ if (options)
+ {
+ delete options;
+ }
if(ui::Engine::Ref().GetWindow() == gameView)
{
ui::Engine::Ref().CloseWindow();
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp
index 0dbf2f7..423a611 100644
--- a/src/game/GameModel.cpp
+++ b/src/game/GameModel.cpp
@@ -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)
diff --git a/src/game/ToolButton.cpp b/src/game/ToolButton.cpp
index aa31b3d..c19f0c6 100644
--- a/src/game/ToolButton.cpp
+++ b/src/game/ToolButton.cpp
@@ -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)
diff --git a/src/interface/Engine.cpp b/src/interface/Engine.cpp
index cdfadc8..0fb24a3 100644
--- a/src/interface/Engine.cpp
+++ b/src/interface/Engine.cpp
@@ -46,6 +46,8 @@ Engine::~Engine()
delete windows.top();
windows.pop();
}
+ if (lastBuffer)
+ free(lastBuffer);
}
void Engine::Begin(int width, int height)
diff --git a/src/preview/PreviewModel.cpp b/src/preview/PreviewModel.cpp
index e1578e1..b5dbf40 100644
--- a/src/preview/PreviewModel.cpp
+++ b/src/preview/PreviewModel.cpp
@@ -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;
+ }
}
diff --git a/src/preview/PreviewView.cpp b/src/preview/PreviewView.cpp
index 4b12ea9..61a0c8f 100644
--- a/src/preview/PreviewView.cpp
+++ b/src/preview/PreviewView.cpp
@@ -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;
+ }
}
diff --git a/src/search/SearchController.cpp b/src/search/SearchController.cpp
index 012b761..26b54bb 100644
--- a/src/search/SearchController.cpp
+++ b/src/search/SearchController.cpp
@@ -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)
diff --git a/src/search/SearchView.cpp b/src/search/SearchView.cpp
index f1f6c3b..3e73496 100644
--- a/src/search/SearchView.cpp
+++ b/src/search/SearchView.cpp
@@ -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;