summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-04-10 22:53:13 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-04-10 22:53:13 (GMT)
commitbb372f7a06b0163da7b1f2749e43ba7c8c1c0c5a (patch)
tree0754a2d7ca040aba3932b66fc9236117562d6b32
parent995dc5b96429473761ff0a60982f0501cfa6ad6b (diff)
downloadswift-bb372f7a06b0163da7b1f2749e43ba7c8c1c0c5a.zip
swift-bb372f7a06b0163da7b1f2749e43ba7c8c1c0c5a.tar.bz2
Fix two segfaults on signout/signin.
Connections that don't go away when the slot is destroyed. Resolves: #310
-rw-r--r--Swift/Controllers/EventWindowController.cpp3
-rw-r--r--Swift/Controllers/EventWindowController.h1
-rw-r--r--Swift/Controllers/RosterController.cpp10
-rw-r--r--Swift/Controllers/RosterController.h5
-rw-r--r--Swift/QtUI/QtMainWindowFactory.cpp4
5 files changed, 14 insertions, 9 deletions
diff --git a/Swift/Controllers/EventWindowController.cpp b/Swift/Controllers/EventWindowController.cpp
index 1cf3dec..22cfbb3 100644
--- a/Swift/Controllers/EventWindowController.cpp
+++ b/Swift/Controllers/EventWindowController.cpp
@@ -14,7 +14,8 @@ EventWindowController::EventWindowController(EventController* eventController, E
eventController_ = eventController;
windowFactory_ = windowFactory;
window_ = windowFactory_->createEventWindow();
- eventController_->onEventQueueEventAdded.connect(boost::bind(&EventWindowController::handleEventQueueEventAdded, this, _1));
+ printf("Got new window, pointer %d\n", (int)window_);
+ eventAddedConnection_ = eventController_->onEventQueueEventAdded.connect(boost::bind(&EventWindowController::handleEventQueueEventAdded, this, _1));
}
EventWindowController::~EventWindowController() {
diff --git a/Swift/Controllers/EventWindowController.h b/Swift/Controllers/EventWindowController.h
index 476824f..0710da5 100644
--- a/Swift/Controllers/EventWindowController.h
+++ b/Swift/Controllers/EventWindowController.h
@@ -24,6 +24,7 @@ namespace Swift {
EventController* eventController_;
EventWindowFactory* windowFactory_;
EventWindow* window_;
+ boost::bsignals::scoped_connection eventAddedConnection_;
};
}
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index d047d17..ea7c7bb 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -39,17 +39,17 @@ RosterController::RosterController(const JID& jid, boost::shared_ptr<XMPPRoster>
eventController_ = eventController;
roster_->addFilter(offlineFilter_);
- mainWindow_->onJoinMUCRequest.connect(boost::bind(&RosterController::handleJoinMUCRequest, this, _1, _2));
- mainWindow_->onChangeStatusRequest.connect(boost::bind(&RosterController::handleChangeStatusRequest, this, _1, _2));
- mainWindow_->onShowOfflineToggled.connect(boost::bind(&RosterController::handleShowOfflineToggled, this, _1));
- mainWindow_->onSignOutRequest.connect(boost::bind(boost::ref(onSignOutRequest)));
+ joinMUCConnection_ = mainWindow_->onJoinMUCRequest.connect(boost::bind(&RosterController::handleJoinMUCRequest, this, _1, _2));
+ changeStatusConnection_ = mainWindow_->onChangeStatusRequest.connect(boost::bind(&RosterController::handleChangeStatusRequest, this, _1, _2));
+ showOfflineConnection_ = mainWindow_->onShowOfflineToggled.connect(boost::bind(&RosterController::handleShowOfflineToggled, this, _1));
+ signOutConnection_ = mainWindow_->onSignOutRequest.connect(boost::bind(boost::ref(onSignOutRequest)));
roster_->onUserAction.connect(boost::bind(&RosterController::handleUserAction, this, _1));
xmppRoster_->onJIDAdded.connect(boost::bind(&RosterController::handleOnJIDAdded, this, _1));
xmppRoster_->onJIDUpdated.connect(boost::bind(&RosterController::handleOnJIDUpdated, this, _1, _2, _3));
xmppRoster_->onJIDRemoved.connect(boost::bind(&RosterController::handleOnJIDRemoved, this, _1));
presenceOracle_->onPresenceSubscriptionRequest.connect(boost::bind(&RosterController::handleSubscriptionRequest, this, _1, _2));
presenceOracle_->onPresenceChange.connect(boost::bind(&RosterController::handleIncomingPresence, this, _1, _2));
- uiEventStream->onUIEvent.connect(boost::bind(&RosterController::handleUIEvent, this, _1));
+ uiEventConnection_ = uiEventStream->onUIEvent.connect(boost::bind(&RosterController::handleUIEvent, this, _1));
avatarManager_ = NULL;
setAvatarManager(avatarManager);
setNickResolver(nickResolver);
diff --git a/Swift/Controllers/RosterController.h b/Swift/Controllers/RosterController.h
index 651c157..32e3be6 100644
--- a/Swift/Controllers/RosterController.h
+++ b/Swift/Controllers/RosterController.h
@@ -70,6 +70,11 @@ namespace Swift {
NickResolver* nickResolver_;
PresenceOracle* presenceOracle_;
EventController* eventController_;
+ boost::bsignals::scoped_connection joinMUCConnection_;
+ boost::bsignals::scoped_connection changeStatusConnection_;
+ boost::bsignals::scoped_connection showOfflineConnection_;
+ boost::bsignals::scoped_connection signOutConnection_;
+ boost::bsignals::scoped_connection uiEventConnection_;
};
}
#endif
diff --git a/Swift/QtUI/QtMainWindowFactory.cpp b/Swift/QtUI/QtMainWindowFactory.cpp
index f58cca7..12e3532 100644
--- a/Swift/QtUI/QtMainWindowFactory.cpp
+++ b/Swift/QtUI/QtMainWindowFactory.cpp
@@ -15,9 +15,7 @@ QtMainWindowFactory::QtMainWindowFactory(QtTreeWidgetFactory *treeWidgetFactory)
}
MainWindow* QtMainWindowFactory::createMainWindow(UIEventStream* eventStream) {
- if (!lastWindow_) {
- lastWindow_ = new QtMainWindow(eventStream, treeWidgetFactory_);
- }
+ lastWindow_ = new QtMainWindow(eventStream, treeWidgetFactory_);
return lastWindow_;
}