diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index c866805ef..1e10b0e2c 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 0dbf2f7bf..423a6112e 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -179,6 +179,10 @@ GameModel::~GameModel() { delete *iter; } + for(std::vector::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 aa31b3de2..c19f0c6df 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 cdfadc805..0fb24a3f6 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 e1578e116..b5dbf40d2 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 4b12ea9c5..61a0c8f46 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 012b761b3..26b54bb57 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 f1f6c3ba9..3e73496b4 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;