diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index 455b724d9..7516a4ac3 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -125,6 +125,13 @@ void ChatList::setSelf(QSharedPointer me) { } auto linphoneChatRooms = currentAccount->filterChatRooms(Utils::appStringToCoreString(mFilter)); for (auto it : linphoneChatRooms) { + auto state = it->getState(); + if (state == linphone::ChatRoom::State::CreationFailed || + state == linphone::ChatRoom::State::CreationPending || + state == linphone::ChatRoom::State::TerminationPending || + state == linphone::ChatRoom::State::Instantiated) { + continue; + } auto model = createChatCore(it); chats->push_back(model); } diff --git a/Linphone/core/chat/ChatProxy.cpp b/Linphone/core/chat/ChatProxy.cpp index 9266e4b20..3d4cb462f 100644 --- a/Linphone/core/chat/ChatProxy.cpp +++ b/Linphone/core/chat/ChatProxy.cpp @@ -23,6 +23,8 @@ #include "ChatList.hpp" #include "core/App.hpp" +#include + DEFINE_ABSTRACT_OBJECT(ChatProxy) ChatProxy::ChatProxy(QObject *parent) { @@ -50,7 +52,8 @@ void ChatProxy::setSourceModel(QAbstractItemModel *model) { emit chatAdded(new ChatGui(chatCore)); } }); - connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); }); + connect(newChatList, &ChatList::dataChanged, this, + [this] { QTimer::singleShot(0, this, [this] { invalidate(); }); }); newChatList->lUpdate(); } QSortFilterProxyModel::setSourceModel(newChatList);