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;