From 971489f8f1ceb56a0aa8808aa24f2bf540f4de92 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Mon, 29 May 2017 21:02:01 +0200 Subject: [PATCH] fix crash bug when closing notebook --- widgets/chatwidget.cpp | 5 +++-- widgets/chatwidget.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/widgets/chatwidget.cpp b/widgets/chatwidget.cpp index 4b41998cf..150fff1c9 100644 --- a/widgets/chatwidget.cpp +++ b/widgets/chatwidget.cpp @@ -36,6 +36,7 @@ ChatWidget::ChatWidget(QWidget *parent) ChatWidget::~ChatWidget() { + detachChannel(); } std::shared_ptr ChatWidget::getChannel() const @@ -69,7 +70,7 @@ void ChatWidget::setChannelName(const QString &name) if (!_channelName.isEmpty()) { ChannelManager::getInstance().removeChannel(_channelName); - detachChannel(_channel); + detachChannel(); } // update members @@ -128,7 +129,7 @@ void ChatWidget::attachChannel(SharedChannel channel) } } -void ChatWidget::detachChannel(std::shared_ptr channel) +void ChatWidget::detachChannel() { // on message added _messageAppendedConnection.disconnect(); diff --git a/widgets/chatwidget.h b/widgets/chatwidget.h index 9f34216ea..35bed5b5d 100644 --- a/widgets/chatwidget.h +++ b/widgets/chatwidget.h @@ -42,7 +42,7 @@ protected: private: void attachChannel(std::shared_ptr _channel); - void detachChannel(std::shared_ptr _channel); + void detachChannel(); messages::LimitedQueue _messages;