diff options
| author | Thanos Doukoudakis <thanos.doukoudakis@isode.com> | 2018-02-14 18:00:51 (GMT) |
|---|---|---|
| committer | Thanos Doukoudakis <thanos.doukoudakis@isode.com> | 2018-02-14 18:02:16 (GMT) |
| commit | 9f63c4a1456e154e6b48de2f9a8fa5105c8c020b (patch) | |
| tree | 4f3fa39370bec74aec729e709bf6332bfc0bdb45 /Swift | |
| parent | 1b99be2dc6470f13fba252264e82a3571768d199 (diff) | |
| download | swift-9f63c4a1456e154e6b48de2f9a8fa5105c8c020b.zip swift-9f63c4a1456e154e6b48de2f9a8fa5105c8c020b.tar.bz2 | |
Fix a crash that occurs when inviting users in a chat
After inviting people to a chat, and converting to a MUC room, some of the
chat window signals were still signaling the original chat controller,
that has been destroying, causing a crash.
Test-Information:
Tested the changes in Windows 10 (64 bit), after triggering the
dayChangeTimer, and onContinuationsBroken signal that was causing the
crash.
Change-Id: I70a80ab2653ed87a1dbea851157d95fb5918913f
Diffstat (limited to 'Swift')
| -rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 16 | ||||
| -rw-r--r-- | Swift/Controllers/Chat/ChatController.h | 1 | ||||
| -rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 3 |
3 files changed, 18 insertions, 2 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index fe8e870..a8ffaf4 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp | |||
| @@ -86,7 +86,7 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ | |||
| 86 | chatStateNotifier_->setContactIsOnline(theirPresence && theirPresence->getType() == Presence::Available); | 86 | chatStateNotifier_->setContactIsOnline(theirPresence && theirPresence->getType() == Presence::Available); |
| 87 | startMessage += "."; | 87 | startMessage += "."; |
| 88 | chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(startMessage), ChatWindow::DefaultDirection); | 88 | chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(startMessage), ChatWindow::DefaultDirection); |
| 89 | chatWindow_->onContinuationsBroken.connect([this, startMessage]() { chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(startMessage), ChatWindow::DefaultDirection); }); | 89 | continuationsBrokenConnection_ = chatWindow_->onContinuationsBroken.connect([this, startMessage]() { chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(startMessage), ChatWindow::DefaultDirection); }); |
| 90 | chatWindow_->onUserTyping.connect(boost::bind(&ChatStateNotifier::setUserIsTyping, chatStateNotifier_)); | 90 | chatWindow_->onUserTyping.connect(boost::bind(&ChatStateNotifier::setUserIsTyping, chatStateNotifier_)); |
| 91 | chatWindow_->onUserCancelsTyping.connect(boost::bind(&ChatStateNotifier::userCancelledNewMessage, chatStateNotifier_)); | 91 | chatWindow_->onUserCancelsTyping.connect(boost::bind(&ChatStateNotifier::userCancelledNewMessage, chatStateNotifier_)); |
| 92 | chatWindow_->onFileTransferStart.connect(boost::bind(&ChatController::handleFileTransferStart, this, _1, _2)); | 92 | chatWindow_->onFileTransferStart.connect(boost::bind(&ChatController::handleFileTransferStart, this, _1, _2)); |
| @@ -585,8 +585,20 @@ JID ChatController::messageCorrectionJID(const JID& fromJID) { | |||
| 585 | } | 585 | } |
| 586 | 586 | ||
| 587 | ChatWindow* ChatController::detachChatWindow() { | 587 | ChatWindow* ChatController::detachChatWindow() { |
| 588 | chatWindow_->onUserTyping.disconnect(boost::bind(&ChatStateNotifier::setUserIsTyping, chatStateNotifier_)); | 588 | continuationsBrokenConnection_.disconnect(); |
| 589 | chatWindow_->onClosed.disconnect(boost::bind(&ChatController::handleWindowClosed, this)); | ||
| 590 | chatWindow_->onInviteToChat.disconnect(boost::bind(&ChatController::handleInviteToChat, this, _1)); | ||
| 591 | chatWindow_->onUnblockUserRequest.disconnect(boost::bind(&ChatController::handleUnblockUserRequest, this)); | ||
| 592 | chatWindow_->onBlockUserRequest.disconnect(boost::bind(&ChatController::handleBlockUserRequest, this)); | ||
| 593 | chatWindow_->onWhiteboardWindowShow.disconnect(boost::bind(&ChatController::handleWhiteboardWindowShow, this)); | ||
| 594 | chatWindow_->onWhiteboardSessionCancel.disconnect(boost::bind(&ChatController::handleWhiteboardSessionCancel, this)); | ||
| 595 | chatWindow_->onWhiteboardSessionAccept.disconnect(boost::bind(&ChatController::handleWhiteboardSessionAccept, this)); | ||
| 596 | chatWindow_->onSendFileRequest.disconnect(boost::bind(&ChatController::handleSendFileRequest, this, _1)); | ||
| 597 | chatWindow_->onFileTransferCancel.disconnect(boost::bind(&ChatController::handleFileTransferCancel, this, _1)); | ||
| 598 | chatWindow_->onFileTransferAccept.disconnect(boost::bind(&ChatController::handleFileTransferAccept, this, _1, _2)); | ||
| 599 | chatWindow_->onFileTransferStart.disconnect(boost::bind(&ChatController::handleFileTransferStart, this, _1, _2)); | ||
| 589 | chatWindow_->onUserCancelsTyping.disconnect(boost::bind(&ChatStateNotifier::userCancelledNewMessage, chatStateNotifier_)); | 600 | chatWindow_->onUserCancelsTyping.disconnect(boost::bind(&ChatStateNotifier::userCancelledNewMessage, chatStateNotifier_)); |
| 601 | chatWindow_->onUserTyping.disconnect(boost::bind(&ChatStateNotifier::setUserIsTyping, chatStateNotifier_)); | ||
| 590 | return ChatControllerBase::detachChatWindow(); | 602 | return ChatControllerBase::detachChatWindow(); |
| 591 | } | 603 | } |
| 592 | 604 | ||
diff --git a/Swift/Controllers/Chat/ChatController.h b/Swift/Controllers/Chat/ChatController.h index d5011e4..a9093d0 100644 --- a/Swift/Controllers/Chat/ChatController.h +++ b/Swift/Controllers/Chat/ChatController.h | |||
| @@ -113,6 +113,7 @@ namespace Swift { | |||
| 113 | boost::signals2::scoped_connection blockingOnStateChangedConnection_; | 113 | boost::signals2::scoped_connection blockingOnStateChangedConnection_; |
| 114 | boost::signals2::scoped_connection blockingOnItemAddedConnection_; | 114 | boost::signals2::scoped_connection blockingOnItemAddedConnection_; |
| 115 | boost::signals2::scoped_connection blockingOnItemRemovedConnection_; | 115 | boost::signals2::scoped_connection blockingOnItemRemovedConnection_; |
| 116 | boost::signals2::scoped_connection continuationsBrokenConnection_; | ||
| 116 | 117 | ||
| 117 | boost::optional<ChatWindow::AlertID> deliveryReceiptAlert_; | 118 | boost::optional<ChatWindow::AlertID> deliveryReceiptAlert_; |
| 118 | boost::optional<ChatWindow::AlertID> blockedContactAlert_; | 119 | boost::optional<ChatWindow::AlertID> blockedContactAlert_; |
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index 0fc735a..19bbf8d 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp | |||
| @@ -58,6 +58,9 @@ void ChatControllerBase::handleContinuationsBroken() { | |||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | ChatWindow* ChatControllerBase::detachChatWindow() { | 60 | ChatWindow* ChatControllerBase::detachChatWindow() { |
| 61 | chatWindow_->onContinuationsBroken.disconnect(boost::bind(&ChatControllerBase::handleContinuationsBroken, this)); | ||
| 62 | chatWindow_->onSendMessageRequest.disconnect(boost::bind(&ChatControllerBase::handleSendMessageRequest, this, _1, _2)); | ||
| 63 | chatWindow_->onAllMessagesRead.disconnect(boost::bind(&ChatControllerBase::handleAllMessagesRead, this)); | ||
| 61 | ChatWindow* chatWindow = chatWindow_; | 64 | ChatWindow* chatWindow = chatWindow_; |
| 62 | chatWindow_ = nullptr; | 65 | chatWindow_ = nullptr; |
| 63 | return chatWindow; | 66 | return chatWindow; |
Swift