Fix crash : chat room model need a reset on init() as elements are erased

This commit is contained in:
Julien Wadel 2021-08-16 10:18:07 +02:00
parent ed13cc174b
commit edec781e6f
2 changed files with 6 additions and 3 deletions

View file

@ -739,9 +739,9 @@ void ChatRoomModel::initEntries(){
mIsInitialized = true;
if(entries.size() >0){
beginInsertRows(QModelIndex(), 0, entries.size()-1);
beginResetModel();
mEntries = entries;
endInsertRows();
endResetModel();
}
}

View file

@ -181,7 +181,10 @@ bool ChatRoomProxyModel::lessThan (const QModelIndex &left, const QModelIndex &r
b = r.value<ChatNoticeModel*>();
if(!b)
b = r.value<ChatCallModel*>();
if(!b)
return true;
if(!a)
return false;
return a->mTimestamp < b->mTimestamp;
}
// -----------------------------------------------------------------------------