remove connect already in QSortFilterProxyModel (leading to crash in Windows)
This commit is contained in:
parent
f8a4f73993
commit
94df04c347
3 changed files with 6 additions and 7 deletions
|
|
@ -93,15 +93,17 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setIsUpdating(true);
|
setIsUpdating(true);
|
||||||
|
beginResetModel();
|
||||||
mModelConnection->invokeToModel([this]() {
|
mModelConnection->invokeToModel([this]() {
|
||||||
mustBeInLinphoneThread(getClassName());
|
mustBeInLinphoneThread(getClassName());
|
||||||
beginResetModel();
|
|
||||||
// Avoid copy to lambdas
|
// Avoid copy to lambdas
|
||||||
QList<QSharedPointer<ChatCore>> *chats = new QList<QSharedPointer<ChatCore>>();
|
QList<QSharedPointer<ChatCore>> *chats = new QList<QSharedPointer<ChatCore>>();
|
||||||
auto currentAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
|
auto currentAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
|
||||||
if (!currentAccount) {
|
if (!currentAccount) {
|
||||||
setIsUpdating(false);
|
mModelConnection->invokeToCore([this, chats]() {
|
||||||
endResetModel();
|
setIsUpdating(false);
|
||||||
|
endResetModel();
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto linphoneChatRooms = currentAccount->filterChatRooms(Utils::appStringToCoreString(mFilter));
|
auto linphoneChatRooms = currentAccount->filterChatRooms(Utils::appStringToCoreString(mFilter));
|
||||||
|
|
@ -122,8 +124,8 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
|
||||||
mList.clear();
|
mList.clear();
|
||||||
for (auto &chat : *chats) {
|
for (auto &chat : *chats) {
|
||||||
connectItem(chat);
|
connectItem(chat);
|
||||||
|
mList.append(chat);
|
||||||
}
|
}
|
||||||
add(*chats);
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
setIsUpdating(false);
|
setIsUpdating(false);
|
||||||
delete chats;
|
delete chats;
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,6 @@ void ChatProxy::setSourceModel(QAbstractItemModel *model) {
|
||||||
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
|
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
|
||||||
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
|
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
|
||||||
connect(newChatList, &ChatList::dataChanged, 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);
|
QSortFilterProxyModel::setSourceModel(newChatList);
|
||||||
sort(0);
|
sort(0);
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ ListView {
|
||||||
mainItem.currentIndex = index
|
mainItem.currentIndex = index
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: cacheBuffer = Math.max(contentHeight, 0) //contentHeight>0 ? contentHeight : 0// cache all items
|
|
||||||
// remove binding loop
|
// remove binding loop
|
||||||
onContentHeightChanged: Qt.callLater(function () {
|
onContentHeightChanged: Qt.callLater(function () {
|
||||||
if (mainItem)
|
if (mainItem)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue