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;