From 871af4828a0fc64637b8e08ca2d1df6233849d55 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Wed, 15 Apr 2009 22:08:41 -0600 Subject: Clean up some more memory leaks And remove an unneeded variable --- src/gui/login.cpp | 5 +++++ src/gui/login.h | 2 ++ src/gui/partywindow.cpp | 3 ++- src/gui/setup_players.cpp | 5 +++-- src/gui/setup_players.h | 2 ++ src/main.cpp | 3 +-- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 92c6050c..c1ffb658 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -129,6 +129,11 @@ LoginDialog::LoginDialog(LoginData *loginData): mOkButton->setEnabled(canSubmit()); } +LoginDialog::~LoginDialog() +{ + delete mServerList; +} + void LoginDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "ok" && canSubmit()) diff --git a/src/gui/login.h b/src/gui/login.h index 7224c64d..6d35f5ba 100644 --- a/src/gui/login.h +++ b/src/gui/login.h @@ -51,6 +51,8 @@ class LoginDialog : public Window, public gcn::ActionListener, */ LoginDialog(LoginData *loginData); + ~LoginDialog(); + /** * Called when receiving actions from the widgets. */ diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index aea1388b..9c2d3161 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -26,6 +26,7 @@ #include "net/net.h" #include "net/partyhandler.h" +#include "utils/dtor.h" #include "utils/gettext.h" #include "utils/strprintf.h" @@ -45,7 +46,7 @@ PartyWindow::PartyWindow() : Window(_("Party")) PartyWindow::~PartyWindow() { - mMembers.clear(); + delete_all(mMembers); } void PartyWindow::draw(gcn::Graphics *graphics) diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index e093a5b6..367d21a2 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -240,8 +240,8 @@ Setup_Players::Setup_Players(): RELATION_CHOICE_COLUMN_WIDTH); mPlayerTitleTable->setBackgroundColor(gcn::Color(0xbf, 0xbf, 0xbf)); - gcn::ListModel *ignoreChoices = new IgnoreChoicesListModel; - mIgnoreActionChoicesBox = new DropDown(ignoreChoices); + mIgnoreActionChoicesModel = new IgnoreChoicesListModel; + mIgnoreActionChoicesBox = new DropDown(mIgnoreActionChoicesModel); for (int i = 0; i < COLUMNS_NR; i++) { @@ -300,6 +300,7 @@ Setup_Players::Setup_Players(): Setup_Players::~Setup_Players() { player_relations.removeListener(this); + delete mIgnoreActionChoicesModel; } diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h index 14b9a018..c2e6a682 100644 --- a/src/gui/setup_players.h +++ b/src/gui/setup_players.h @@ -63,6 +63,8 @@ private: gcn::CheckBox *mDefaultWhisper; gcn::Button *mDeleteButton; + + gcn::ListModel *mIgnoreActionChoicesModel; gcn::DropDown *mIgnoreActionChoicesBox; bool mWhisperTab; diff --git a/src/main.cpp b/src/main.cpp index f6d4a4f5..f6126693 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -947,8 +947,7 @@ int main(int argc, char *argv[]) new TmwServ::GeneralHandler; // Currently doesn't need registration #else Network *network = new Network; - EAthena::GeneralHandler *generalHandler = new EAthena::GeneralHandler; - network->registerHandler(generalHandler); + network->registerHandler(new EAthena::GeneralHandler); #endif Net::getGeneralHandler()->load(); -- cgit v1.2.3-70-g09d2