summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-15 16:09:08 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-15 16:09:08 (GMT)
commitf52aa93c3d6d5976b072d31f3d3336beb1596ece (patch)
tree2435122519eda9e9612e18c32997b0510528e032
parentcb32ea0954558da4bec9d4e9f13710a7f1a17d5a (diff)
downloadswift-f52aa93c3d6d5976b072d31f3d3336beb1596ece.zip
swift-f52aa93c3d6d5976b072d31f3d3336beb1596ece.tar.bz2
Fixed a segfault with pending events.
Release-Notes: Fixed a potential crash on signout when events are pending.
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.cpp6
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/Swift/Controllers/XMPPEvents/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp
index 381a5a1..f2fdcfe 100644
--- a/Swift/Controllers/XMPPEvents/EventController.cpp
+++ b/Swift/Controllers/XMPPEvents/EventController.cpp
@@ -18,6 +18,12 @@ namespace Swift {
EventController::EventController() {
}
+EventController::~EventController() {
+ foreach(boost::shared_ptr<StanzaEvent> event, events_) {
+ event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event));
+ }
+}
+
void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent) {
boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(sourceEvent);
boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(sourceEvent);
diff --git a/Swift/Controllers/XMPPEvents/EventController.h b/Swift/Controllers/XMPPEvents/EventController.h
index 61c5c47..1e0a069 100644
--- a/Swift/Controllers/XMPPEvents/EventController.h
+++ b/Swift/Controllers/XMPPEvents/EventController.h
@@ -17,10 +17,12 @@
namespace Swift {
typedef std::vector<boost::shared_ptr<StanzaEvent> > EventList;
- class EventController : public boost::bsignals::trackable{
+ class EventController {
public:
EventController();
+ ~EventController();
+
void handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent);
boost::signal<void (int)> onEventQueueLengthChange;
boost::signal<void (boost::shared_ptr<StanzaEvent>)> onEventQueueEventAdded;