diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index 27e81a459..bd1b38545 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -523,11 +523,15 @@ void ChatCore::resetEventLogList(QList> list) { void ChatCore::appendEventLogsToEventLogList(QList> list) { int nbAdded = 0; for (auto &e : list) { - if (mEventLogList.contains(e)) continue; - if (auto message = e->getChatMessageCore()) - connect(message.get(), &ChatMessageCore::isReadChanged, this, [this] { emit lUpdateUnreadCount(); }); - mEventLogList.append(e); - ++nbAdded; + auto it = std::find_if(mEventLogList.begin(), mEventLogList.end(), [e](QSharedPointer event) { + return e->getEventLogId() == event->getEventLogId(); + }); + if (it == mEventLogList.end()) { + if (auto message = e->getChatMessageCore()) + connect(message.get(), &ChatMessageCore::isReadChanged, this, [this] { emit lUpdateUnreadCount(); }); + mEventLogList.append(e); + ++nbAdded; + } } if (nbAdded > 0) emit eventsInserted(list); } diff --git a/Linphone/core/chat/message/EventLogCore.hpp b/Linphone/core/chat/message/EventLogCore.hpp index bb5121389..600c71ea3 100644 --- a/Linphone/core/chat/message/EventLogCore.hpp +++ b/Linphone/core/chat/message/EventLogCore.hpp @@ -75,7 +75,7 @@ private: QSharedPointer mChatMessageCore = nullptr; QSharedPointer mCallHistoryCore = nullptr; LinphoneEnums::EventLogType mEventLogType; - bool mHandled; + bool mHandled = false; bool mImportant; bool mEphemeralRelated; QString mEventDetails;