From 21312c99db9e3056fe2777ffc985a404b8e53d00 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Wed, 17 Dec 2025 11:48:38 +0100 Subject: [PATCH] fix chat room creation inserted twice in list --- Linphone/core/chat/ChatList.cpp | 10 +++++++++- Linphone/view/Control/Display/Chat/Event.qml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index 0f3944c42..36179c3fd 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -175,7 +175,11 @@ void ChatList::setSelf(QSharedPointer me) { [this, addChatToList](const std::shared_ptr &core, const std::shared_ptr &chatRoom, linphone::ChatRoom::State state) { if (state == linphone::ChatRoom::State::Created) { - if (chatRoom->getAccount() != core->getDefaultAccount()) { + auto chatAccount = chatRoom->getAccount(); + auto defaultAccount = core->getDefaultAccount(); + if (!chatAccount || !defaultAccount) return; + if (!chatAccount->getParams()->getIdentityAddress()->weakEqual( + defaultAccount->getParams()->getIdentityAddress())) { qWarning() << log().arg("Chatroom does not refer to current account, return"); return; } @@ -203,6 +207,10 @@ int ChatList::findChatIndex(ChatGui *chatGui) { bool ChatList::addChatInList(QSharedPointer chatCore) { mustBeInMainThread(log().arg(Q_FUNC_INFO)); + if (chatCore->getIdentifier().isEmpty()) { + qWarning() << "ChatRoom with invalid identifier cannot be added to the list, return"; + return false; + } auto chatList = getSharedList(); auto it = std::find_if(chatList.begin(), chatList.end(), [chatCore](const QSharedPointer item) { return item && chatCore && item->getIdentifier() == chatCore->getIdentifier(); diff --git a/Linphone/view/Control/Display/Chat/Event.qml b/Linphone/view/Control/Display/Chat/Event.qml index 7ca779bc5..f6be58be2 100644 --- a/Linphone/view/Control/Display/Chat/Event.qml +++ b/Linphone/view/Control/Display/Chat/Event.qml @@ -7,7 +7,7 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils RowLayout { id: mainItem height: Utils.getSizeWithScreenRatio(40) - visible: eventLogCore.handled + visible: eventLogGui.core.handled property EventLogGui eventLogGui Rectangle {