Don't crash when leaving an opened room

Should fix #568
This commit is contained in:
Tobias Fella
2023-01-28 20:23:10 +01:00
parent 9d5303113e
commit ebd521e2ee
2 changed files with 3 additions and 2 deletions

View File

@@ -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<NeoChatRoom> previousRoom = nullptr;
if (previousRoom) {
disconnect(previousRoom, &NeoChatRoom::chatBoxTextChanged, this, nullptr);
}

View File

@@ -7,6 +7,7 @@
#include <QAbstractListModel>
#include <QObject>
#include <QPointer>
class NeoChatRoom;
@@ -70,7 +71,7 @@ private Q_SLOTS:
void avatarChanged(Quotient::User *user, const Quotient::Room *context);
private:
NeoChatRoom *m_currentRoom;
QPointer<NeoChatRoom> m_currentRoom;
QList<Quotient::User *> m_users;
int findUserPos(Quotient::User *user) const;