From ebd521e2eea6f56f2707d64643e58592db2c868f Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sat, 28 Jan 2023 20:23:10 +0100 Subject: [PATCH] Don't crash when leaving an opened room Should fix #568 --- src/chatdocumenthandler.cpp | 2 +- src/models/userlistmodel.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/chatdocumenthandler.cpp b/src/chatdocumenthandler.cpp index e8f591d11..d08656a04 100644 --- a/src/chatdocumenthandler.cpp +++ b/src/chatdocumenthandler.cpp @@ -105,7 +105,7 @@ ChatDocumentHandler::ChatDocumentHandler(QObject *parent) { connect(this, &ChatDocumentHandler::roomChanged, this, [this]() { m_completionModel->setRoom(m_room); - static NeoChatRoom *previousRoom = nullptr; + static QPointer previousRoom = nullptr; if (previousRoom) { disconnect(previousRoom, &NeoChatRoom::chatBoxTextChanged, this, nullptr); } diff --git a/src/models/userlistmodel.h b/src/models/userlistmodel.h index 644f7a424..e48f2e147 100644 --- a/src/models/userlistmodel.h +++ b/src/models/userlistmodel.h @@ -7,6 +7,7 @@ #include #include +#include class NeoChatRoom; @@ -70,7 +71,7 @@ private Q_SLOTS: void avatarChanged(Quotient::User *user, const Quotient::Room *context); private: - NeoChatRoom *m_currentRoom; + QPointer m_currentRoom; QList m_users; int findUserPos(Quotient::User *user) const;