summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-30 13:16:43 -0600
committerJared Adams <jaxad0127@gmail.com>2010-03-30 14:29:28 -0600
commit0c8fd1b9e6a4840bb573c26602f439e7c6ab9d7d (patch)
tree2996cae62236089221bc7c7bad6e834021db6114 /src
parent43abf72c78b492fa1cd383dac3990ee331c217ef (diff)
downloadmana-0c8fd1b9e6a4840bb573c26602f439e7c6ab9d7d.tar.gz
mana-0c8fd1b9e6a4840bb573c26602f439e7c6ab9d7d.tar.bz2
mana-0c8fd1b9e6a4840bb573c26602f439e7c6ab9d7d.tar.xz
mana-0c8fd1b9e6a4840bb573c26602f439e7c6ab9d7d.zip
Fix some memory issues
Reviewed-by: Thorbjørn Lindeijer
Diffstat (limited to 'src')
-rw-r--r--src/gui/theme.cpp1
-rw-r--r--src/net/ea/generalhandler.cpp1
-rw-r--r--src/net/ea/loginhandler.cpp5
-rw-r--r--src/net/ea/loginhandler.h2
-rw-r--r--src/party.cpp12
-rw-r--r--src/party.h6
6 files changed, 25 insertions, 2 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 33e9f301..1406a0d0 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -119,6 +119,7 @@ Theme::~Theme()
{
delete_all(mSkins);
config.removeListener("guialpha", this);
+ delete_all(mProgressColors);
}
Theme *Theme::instance()
diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp
index 021ae08d..749c2409 100644
--- a/src/net/ea/generalhandler.cpp
+++ b/src/net/ea/generalhandler.cpp
@@ -90,7 +90,6 @@ GeneralHandler::GeneralHandler():
mSpecialHandler(new SpecialHandler),
mTradeHandler(new TradeHandler)
{
- //assert(false);
static const Uint16 _messages[] = {
SMSG_CONNECTION_PROBLEM,
0
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index bec97ed7..730535b8 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -55,6 +55,11 @@ LoginHandler::LoginHandler()
loginHandler = this;
}
+LoginHandler::~LoginHandler()
+{
+ delete_all(mWorlds);
+}
+
void LoginHandler::handleMessage(Net::MessageIn &msg)
{
int code, worldCount;
diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h
index 2fd6c661..4e31e64c 100644
--- a/src/net/ea/loginhandler.h
+++ b/src/net/ea/loginhandler.h
@@ -38,6 +38,8 @@ class LoginHandler : public MessageHandler, public Net::LoginHandler
public:
LoginHandler();
+ ~LoginHandler();
+
void handleMessage(Net::MessageIn &msg);
void connect();
diff --git a/src/party.cpp b/src/party.cpp
index b47c194a..22740489 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -46,6 +46,12 @@ Party::Party(short id):
{
parties[id] = this;
}
+
+Party::~Party()
+{
+ clearMembers();
+}
+
PartyMember *Party::addMember(int id, const std::string &name)
{
PartyMember *m;
@@ -132,7 +138,9 @@ void Party::removeMember(PartyMember *member)
if((*itr)->mId == member->mId &&
(*itr)->getName() == member->getName())
{
+ PartyMember *member = (*itr);
mMembers.erase(itr);
+ delete member;
}
++itr;
}
@@ -146,7 +154,9 @@ void Party::removeMember(int id)
{
if((*itr)->mId == id)
{
+ PartyMember *member = (*itr);
mMembers.erase(itr);
+ delete member;
}
++itr;
}
@@ -160,7 +170,9 @@ void Party::removeMember(const std::string &name)
{
if((*itr)->getName() == name)
{
+ PartyMember *member = (*itr);
mMembers.erase(itr);
+ delete member;
}
++itr;
}
diff --git a/src/party.h b/src/party.h
index d50ed7b0..c9d26672 100644
--- a/src/party.h
+++ b/src/party.h
@@ -25,6 +25,8 @@
#include "gui/widgets/avatarlistbox.h"
+#include "utils/dtor.h"
+
#include <map>
#include <string>
#include <vector>
@@ -132,7 +134,7 @@ public:
*/
void removeMember(const std::string &name);
- void clearMembers() { mMembers.clear(); }
+ void clearMembers() { delete_all(mMembers); mMembers.clear(); }
void removeFromMembers();
@@ -176,6 +178,8 @@ private:
*/
Party(short id);
+ ~Party();
+
typedef std::vector<PartyMember*> MemberList;
MemberList mMembers;
std::string mName;