Fix crashing when logging out.

That's a complex issue. Yay!
This commit is contained in:
Black Hat
2018-09-09 21:13:43 +08:00
parent 7c426e254b
commit 5c55856df3
8 changed files with 105 additions and 132 deletions

View File

@@ -14,7 +14,16 @@ RoomListModel::RoomListModel(QObject* parent) : QAbstractListModel(parent) {}
RoomListModel::~RoomListModel() {}
void RoomListModel::setConnection(Connection* connection) {
if (!connection && connection == m_connection) return;
if (connection == m_connection) return;
if (!connection) {
qDebug() << "Removing current connection...";
m_connection->disconnect(this);
m_connection = nullptr;
beginResetModel();
m_rooms.clear();
endResetModel();
return;
}
using QMatrixClient::Room;
m_connection = connection;