summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-07-22 09:18:06 (GMT)
committerRichard Maudsley <richard.maudsley@isode.com>2014-07-22 09:20:54 (GMT)
commit9353d3c692e1cd37bdd15b8dbe75b92be5eaa1c0 (patch)
treeefb9c5532989fa71443f3ad79f4cbfd20d2ea8d7
parente3ff5f241bf6e41829d36502e75f585d9620737e (diff)
downloadswift-9353d3c692e1cd37bdd15b8dbe75b92be5eaa1c0.zip
swift-9353d3c692e1cd37bdd15b8dbe75b92be5eaa1c0.tar.bz2
Fix crash when performing blocking operations after fresh login.
Test-Information: Sign out and sign in again then try blocking a user and confirm that a crash occurs in the BlockListController. After the patch repeat sign out and sign in and confirm that crash nolonger occurs. Change-Id: I9812097fd34f188b2ebf1d8675e47c31fdafdc06
-rw-r--r--Swift/Controllers/BlockListController.cpp3
-rw-r--r--Swift/Controllers/BlockListController.h1
-rw-r--r--Swift/Controllers/MainController.cpp2
3 files changed, 5 insertions, 1 deletions
diff --git a/Swift/Controllers/BlockListController.cpp b/Swift/Controllers/BlockListController.cpp
index 6bdb513..d778883 100644
--- a/Swift/Controllers/BlockListController.cpp
+++ b/Swift/Controllers/BlockListController.cpp
@@ -21,13 +21,14 @@
namespace Swift {
-BlockListController::BlockListController(ClientBlockListManager* blockListManager, UIEventStream* uiEventStream, BlockListEditorWidgetFactory* blockListEditorWidgetFactory, EventController* eventController) : blockListManager_(blockListManager), blockListEditorWidgetFactory_(blockListEditorWidgetFactory), blockListEditorWidget_(0), eventController_(eventController), remainingRequests_(0) {
+BlockListController::BlockListController(ClientBlockListManager* blockListManager, UIEventStream* uiEventStream, BlockListEditorWidgetFactory* blockListEditorWidgetFactory, EventController* eventController) : blockListManager_(blockListManager), blockListEditorWidgetFactory_(blockListEditorWidgetFactory), blockListEditorWidget_(0), eventController_(eventController), remainingRequests_(0), uiEventStream_(uiEventStream) {
uiEventStream->onUIEvent.connect(boost::bind(&BlockListController::handleUIEvent, this, _1));
blockListManager_->getBlockList()->onItemAdded.connect(boost::bind(&BlockListController::handleBlockListChanged, this));
blockListManager_->getBlockList()->onItemRemoved.connect(boost::bind(&BlockListController::handleBlockListChanged, this));
}
BlockListController::~BlockListController() {
+ uiEventStream_->onUIEvent.disconnect(boost::bind(&BlockListController::handleUIEvent, this, _1));
blockListManager_->getBlockList()->onItemAdded.disconnect(boost::bind(&BlockListController::handleBlockListChanged, this));
blockListManager_->getBlockList()->onItemRemoved.disconnect(boost::bind(&BlockListController::handleBlockListChanged, this));
}
diff --git a/Swift/Controllers/BlockListController.h b/Swift/Controllers/BlockListController.h
index 4c9caad..99c143c 100644
--- a/Swift/Controllers/BlockListController.h
+++ b/Swift/Controllers/BlockListController.h
@@ -43,6 +43,7 @@ private:
EventController* eventController_;
std::vector<JID> blockListBeforeEdit;
int remainingRequests_;
+ UIEventStream* uiEventStream_;
};
}
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index a16cbe7..95d8134 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -262,6 +262,8 @@ void MainController::resetClient() {
#endif
delete ftOverview_;
ftOverview_ = NULL;
+ delete blockListController_;
+ blockListController_ = NULL;
delete rosterController_;
rosterController_ = NULL;
delete eventNotifier_;