From f6364253faccbe71de36375537c11324c62f420d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 1 Sep 2009 00:02:28 +0200 Subject: Einige Memory Leaks gefixt --- src/Common/Application.cpp | 8 +++++++- src/Common/ClientConnection.cpp | 7 ++++++- src/Common/ClientConnection.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/Common') diff --git a/src/Common/Application.cpp b/src/Common/Application.cpp index 196e57a..fdbcbeb 100644 --- a/src/Common/Application.cpp +++ b/src/Common/Application.cpp @@ -24,11 +24,15 @@ #include "SystemManager.h" #include "UserManager.h" +#include + namespace Mad { namespace Common { Application::Application(bool server) : authManager(new AuthManager), moduleManager(new ModuleManager(this)), requestManager(new RequestManager(this, server)), -systemManager(new SystemManager), userManager(new UserManager(this)) {} +systemManager(new SystemManager), userManager(new UserManager(this)) { + xmlInitParser(); +} Application::~Application() { delete userManager; @@ -36,6 +40,8 @@ Application::~Application() { delete requestManager; delete moduleManager; delete authManager; + + xmlCleanupParser(); } } diff --git a/src/Common/ClientConnection.cpp b/src/Common/ClientConnection.cpp index 4182806..02abcd1 100644 --- a/src/Common/ClientConnection.cpp +++ b/src/Common/ClientConnection.cpp @@ -28,7 +28,12 @@ ClientConnection::ClientConnection(Core::Application *application) : Connection( connection->connectSignalReceive(boost::bind(&ClientConnection::receive, this, _1)); } -bool ClientConnection::send(const Net::Packet &packet) { +ClientConnection::~ClientConnection() { + connection->disconnect(); + connection->waitWhileConnected(); +} + +bool ClientConnection::send(const Net::Packet &packet) { return connection->send(packet); } diff --git a/src/Common/ClientConnection.h b/src/Common/ClientConnection.h index 7bdceba..302c938 100644 --- a/src/Common/ClientConnection.h +++ b/src/Common/ClientConnection.h @@ -44,6 +44,7 @@ class MAD_COMMON_EXPORT ClientConnection : public Connection { public: ClientConnection(Core::Application *application); + virtual ~ClientConnection(); void connect(const boost::asio::ip::tcp::endpoint &address) throw(Core::Exception); -- cgit v1.2.3