summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-10-08 13:08:27 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-10-08 13:08:27 (GMT)
commitae56c60b12daaa5024795686ffc93310f698d7b8 (patch)
tree07c05de9a7224fa845989238a88bd012be5603e0 /Swift
parent49ecb4179004a209bc699ff6fc58c6ff61047a0b (diff)
downloadswift-contrib-ae56c60b12daaa5024795686ffc93310f698d7b8.zip
swift-contrib-ae56c60b12daaa5024795686ffc93310f698d7b8.tar.bz2
Fixing assorted memory leaks.
Resolves: #329
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp1
-rw-r--r--Swift/Controllers/EventWindowController.cpp1
-rw-r--r--Swift/Controllers/RosterController.cpp2
-rw-r--r--Swift/Controllers/UnitTest/NickResolverTest.cpp1
-rw-r--r--Swift/Controllers/UnitTest/RosterControllerTest.cpp1
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.cpp1
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.h2
-rw-r--r--Swift/Controllers/XMPPEvents/StanzaEvent.h3
8 files changed, 10 insertions, 2 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index d3bc6ce..c8f2f78 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -183,6 +183,7 @@ ChatController* ChatsManager::getChatControllerOrFindAnother(const JID &contact)
}
ChatController* ChatsManager::createNewChatController(const JID& contact) {
+ assert(chatControllers_.find(contact) == chatControllers_.end());
ChatController* controller = new ChatController(jid_, stanzaChannel_, iqRouter_, chatWindowFactory_, contact, nickResolver_, presenceOracle_, avatarManager_, mucRegistry_->isMUC(contact.toBare()), useDelayForLatency_, uiEventStream_, eventController_, timerFactory_, entityCapsManager_);
chatControllers_[contact] = controller;
controller->setAvailableServerFeatures(serverDiscoInfo_);
diff --git a/Swift/Controllers/EventWindowController.cpp b/Swift/Controllers/EventWindowController.cpp
index c02a352..fcafec9 100644
--- a/Swift/Controllers/EventWindowController.cpp
+++ b/Swift/Controllers/EventWindowController.cpp
@@ -29,6 +29,7 @@ void EventWindowController::handleEventQueueEventAdded(boost::shared_ptr<StanzaE
void EventWindowController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) {
window_->removeEvent(event);
window_->addEvent(event, false);
+ event->onConclusion.disconnect(boost::bind(&EventWindowController::handleEventConcluded, this, event));
}
}
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index 48a3aa9..55c99c5 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -67,6 +67,8 @@ RosterController::RosterController(const JID& jid, XMPPRoster* xmppRoster, Avata
RosterController::~RosterController() {
delete offlineFilter_;
delete expandiness_;
+ delete mainWindow_;
+ delete roster_;
}
void RosterController::setNickResolver(NickResolver* nickResolver) {
diff --git a/Swift/Controllers/UnitTest/NickResolverTest.cpp b/Swift/Controllers/UnitTest/NickResolverTest.cpp
index f42a28a..1608731 100644
--- a/Swift/Controllers/UnitTest/NickResolverTest.cpp
+++ b/Swift/Controllers/UnitTest/NickResolverTest.cpp
@@ -51,6 +51,7 @@ class NickResolverTest : public CppUnit::TestFixture {
delete stanzaChannel_;
delete iqRouter_;
delete vCardStorage_;
+ delete xmppRoster_;
}
void testMUCNick() {
diff --git a/Swift/Controllers/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/UnitTest/RosterControllerTest.cpp
index dde48ed..f49ed64 100644
--- a/Swift/Controllers/UnitTest/RosterControllerTest.cpp
+++ b/Swift/Controllers/UnitTest/RosterControllerTest.cpp
@@ -81,6 +81,7 @@ class RosterControllerTest : public CppUnit::TestFixture
delete stanzaChannel_;
delete uiEventStream_;
delete settings_;
+ delete xmppRoster_;
};
GroupRosterItem* groupChild(size_t i) {
diff --git a/Swift/Controllers/XMPPEvents/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp
index 4e70978..381a5a1 100644
--- a/Swift/Controllers/XMPPEvents/EventController.cpp
+++ b/Swift/Controllers/XMPPEvents/EventController.cpp
@@ -31,6 +31,7 @@ void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceE
}
void EventController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) {
+ event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event));
events_.erase(std::remove(events_.begin(), events_.end(), event), events_.end());
onEventQueueLengthChange(events_.size());
}
diff --git a/Swift/Controllers/XMPPEvents/EventController.h b/Swift/Controllers/XMPPEvents/EventController.h
index ba571df..61c5c47 100644
--- a/Swift/Controllers/XMPPEvents/EventController.h
+++ b/Swift/Controllers/XMPPEvents/EventController.h
@@ -17,7 +17,7 @@
namespace Swift {
typedef std::vector<boost::shared_ptr<StanzaEvent> > EventList;
- class EventController {
+ class EventController : public boost::bsignals::trackable{
public:
EventController();
diff --git a/Swift/Controllers/XMPPEvents/StanzaEvent.h b/Swift/Controllers/XMPPEvents/StanzaEvent.h
index 78dd4dc..321d23d 100644
--- a/Swift/Controllers/XMPPEvents/StanzaEvent.h
+++ b/Swift/Controllers/XMPPEvents/StanzaEvent.h
@@ -17,7 +17,8 @@ namespace Swift {
StanzaEvent() : time_(boost::posix_time::microsec_clock::universal_time()) {concluded_ = false;};
virtual ~StanzaEvent() {};
void conclude() {concluded_ = true; onConclusion();};
- /** Do not call this directly from outside the class */
+ /** Do not call this directly from outside the class.
+ * If you connect to this signal, you *must* disconnect from it manually. */
boost::signal<void()> onConclusion;
bool getConcluded() {return concluded_;};
boost::posix_time::ptime getTime() {return time_;}