summaryrefslogtreecommitdiffstats
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/Controllers/XMPPEvents
parent49ecb4179004a209bc699ff6fc58c6ff61047a0b (diff)
downloadswift-contrib-ae56c60b12daaa5024795686ffc93310f698d7b8.zip
swift-contrib-ae56c60b12daaa5024795686ffc93310f698d7b8.tar.bz2
Fixing assorted memory leaks.
Resolves: #329
Diffstat (limited to 'Swift/Controllers/XMPPEvents')
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.cpp1
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.h2
-rw-r--r--Swift/Controllers/XMPPEvents/StanzaEvent.h3
3 files changed, 4 insertions, 2 deletions
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_;}