summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-07-09 16:27:31 +0300
committerAndrei Karas <akaras@inbox.ru>2011-07-09 16:27:31 +0300
commitc06debb4683c784f35093af8fc08ca142a58f5de (patch)
tree8073c846715379d7ee388b88a0cac33e6512df42
parentc8a5af485ef256446c761409c9947a6ca521bc25 (diff)
downloadmanaverse-c06debb4683c784f35093af8fc08ca142a58f5de.tar.gz
manaverse-c06debb4683c784f35093af8fc08ca142a58f5de.tar.bz2
manaverse-c06debb4683c784f35093af8fc08ca142a58f5de.tar.xz
manaverse-c06debb4683c784f35093af8fc08ca142a58f5de.zip
Fix for party memory leak and crash.
-rw-r--r--src/client.cpp2
-rw-r--r--src/net/manaserv/partyhandler.cpp4
-rw-r--r--src/net/manaserv/partyhandler.h6
-rw-r--r--src/net/partyhandler.h2
-rw-r--r--src/net/tmwa/partyhandler.cpp5
-rw-r--r--src/net/tmwa/partyhandler.h2
6 files changed, 20 insertions, 1 deletions
diff --git a/src/client.cpp b/src/client.cpp
index fec408a2f..78688fa03 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -76,6 +76,7 @@
#include "net/net.h"
#include "net/npchandler.h"
#include "net/packetcounters.h"
+#include "net/partyhandler.h"
#include "net/worldinfo.h"
#include "resources/beinginfo.h"
@@ -850,6 +851,7 @@ int Client::exec()
resman->cleanOrphans();
Party::clearParties();
Net::getNpcHandler()->clearDialogs();
+ Net::getPartyHandler()->clear();
}
mOldState = mState;
diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp
index 9a5f19678..0e6af4578 100644
--- a/src/net/manaserv/partyhandler.cpp
+++ b/src/net/manaserv/partyhandler.cpp
@@ -195,4 +195,8 @@ void PartyHandler::requestPartyMembers() const
//chatServerConnection->send(msg);
}
+void PartyHandler::clear()
+{
+}
+
} // namespace ManaServ
diff --git a/src/net/manaserv/partyhandler.h b/src/net/manaserv/partyhandler.h
index 7403d0e36..89924c962 100644
--- a/src/net/manaserv/partyhandler.h
+++ b/src/net/manaserv/partyhandler.h
@@ -76,7 +76,11 @@ public:
PartyShare getShareItems() const
{ return PARTY_SHARE_NO; }
- void setShareItems(PartyShare share A_UNUSED) {}
+ void setShareItems(PartyShare share A_UNUSED)
+ { }
+
+ void clear();
+
private:
Party *mParty;
};
diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h
index e33bac383..246987eb1 100644
--- a/src/net/partyhandler.h
+++ b/src/net/partyhandler.h
@@ -73,6 +73,8 @@ class PartyHandler
virtual void setShareItems(PartyShare share) = 0;
+ virtual void clear() = 0;
+
// virtual void options() = 0;
// virtual void message() = 0;
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index f8e1e4de8..1526100f6 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -575,4 +575,9 @@ void PartyHandler::reload()
taParty = Party::getParty(1);
}
+void PartyHandler::clear()
+{
+ taParty = 0;
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h
index 207bc5f26..d2b204a55 100644
--- a/src/net/tmwa/partyhandler.h
+++ b/src/net/tmwa/partyhandler.h
@@ -78,6 +78,8 @@ class PartyHandler : public MessageHandler, public Net::PartyHandler
void reload();
+ void clear();
+
private:
PartyShare mShareExp, mShareItems;
};