remove connect already in QSortFilterProxyModel (leading to crash in Windows)

This commit is contained in:
gaelle 2025-12-10 17:02:38 +01:00
parent f8a4f73993
commit 94df04c347
3 changed files with 6 additions and 7 deletions

View file

@ -93,15 +93,17 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
return;
}
setIsUpdating(true);
beginResetModel();
mModelConnection->invokeToModel([this]() {
mustBeInLinphoneThread(getClassName());
beginResetModel();
// Avoid copy to lambdas
QList<QSharedPointer<ChatCore>> *chats = new QList<QSharedPointer<ChatCore>>();
auto currentAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
if (!currentAccount) {
setIsUpdating(false);
endResetModel();
mModelConnection->invokeToCore([this, chats]() {
setIsUpdating(false);
endResetModel();
});
return;
}
auto linphoneChatRooms = currentAccount->filterChatRooms(Utils::appStringToCoreString(mFilter));
@ -122,8 +124,8 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
mList.clear();
for (auto &chat : *chats) {
connectItem(chat);
mList.append(chat);
}
add(*chats);
endResetModel();
setIsUpdating(false);
delete chats;

View file

@ -47,8 +47,6 @@ void ChatProxy::setSourceModel(QAbstractItemModel *model) {
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); });
connect(newChatList, &ChatList::modelAboutToBeReset, this, &ChatProxy::modelAboutToBeReset);
connect(newChatList, &ChatList::modelReset, this, &ChatProxy::modelReset);
}
QSortFilterProxyModel::setSourceModel(newChatList);
sort(0);

View file

@ -83,7 +83,6 @@ ListView {
mainItem.currentIndex = index
}
Component.onCompleted: cacheBuffer = Math.max(contentHeight, 0) //contentHeight>0 ? contentHeight : 0// cache all items
// remove binding loop
onContentHeightChanged: Qt.callLater(function () {
if (mainItem)