Fix bug that causes random crashes.

This commit is contained in:
Black Hat
2018-03-02 19:58:55 +08:00
parent d4c2a1ed50
commit 4347755a71
5 changed files with 29 additions and 21 deletions

View File

@@ -5,7 +5,16 @@
#include "controller.h"
RoomListModel::RoomListModel(QMatrixClient::Connection* m_connection) : m_connection(m_connection) {
RoomListModel::RoomListModel() {
}
RoomListModel::~RoomListModel() {
}
void RoomListModel::setConnection(QMatrixClient::Connection *conn) {
m_connection = conn;
beginResetModel();
m_rooms.clear();
connect(m_connection, &QMatrixClient::Connection::newRoom, this, &RoomListModel::addRoom);
@@ -16,10 +25,6 @@ RoomListModel::RoomListModel(QMatrixClient::Connection* m_connection) : m_connec
endResetModel();
}
RoomListModel::~RoomListModel() {
}
QMatrixClient::Room* RoomListModel::roomAt(int row) {
return m_rooms.at(row);
}