From 5e3668fdebd7b13300a82d7302bd3e1b32408b0f Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Tue, 24 Feb 2026 09:26:27 +0100 Subject: [PATCH] Make the beginResetModel/mList.clear()/endResetModel sequence atomic in Event Log and Chat lists delete event log list to avoid core residual leading to SafeConnections not destroyed --- Linphone/core/chat/ChatList.cpp | 8 +++++--- Linphone/core/chat/message/EventLogList.cpp | 9 +++++++-- Linphone/data/languages/de.ts | 8 ++++---- Linphone/data/languages/en.ts | 8 ++++---- Linphone/data/languages/fr.ts | 8 ++++---- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index f47847f19..f21dcfbcb 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -102,8 +102,6 @@ void ChatList::setSelf(QSharedPointer me) { return; } setIsUpdating(true); - beginResetModel(); - mList.clear(); mModelConnection->invokeToModel([this]() { mustBeInLinphoneThread(getClassName()); // Avoid copy to lambdas @@ -111,8 +109,10 @@ void ChatList::setSelf(QSharedPointer me) { auto currentAccount = CoreModel::getInstance()->getCore()->getDefaultAccount(); if (!currentAccount) { mModelConnection->invokeToCore([this, chats]() { - setIsUpdating(false); + beginResetModel(); + mList.clear(); endResetModel(); + setIsUpdating(false); }); return; } @@ -123,6 +123,8 @@ void ChatList::setSelf(QSharedPointer me) { } mModelConnection->invokeToCore([this, chats]() { mustBeInMainThread(getClassName()); + beginResetModel(); + mList.clear(); for (auto &chat : getSharedList()) { if (chat) { disconnectItem(chat); diff --git a/Linphone/core/chat/message/EventLogList.cpp b/Linphone/core/chat/message/EventLogList.cpp index 2374fdbbe..a4632cf24 100644 --- a/Linphone/core/chat/message/EventLogList.cpp +++ b/Linphone/core/chat/message/EventLogList.cpp @@ -309,12 +309,12 @@ void EventLogList::setSelf(QSharedPointer me) { return; } setIsUpdating(true); - beginResetModel(); for (auto &event : getSharedList()) { disconnectItem(event); } - mList.clear(); if (!mChatCore) { + beginResetModel(); + mList.clear(); endResetModel(); setIsUpdating(false); emit modelUpdated(); @@ -322,6 +322,8 @@ void EventLogList::setSelf(QSharedPointer me) { } auto chatModel = mChatCore->getModel(); if (!chatModel) { + beginResetModel(); + mList.clear(); endResetModel(); setIsUpdating(false); emit modelUpdated(); @@ -336,10 +338,13 @@ void EventLogList::setSelf(QSharedPointer me) { if (it->getChatMessage() || model->isHandled()) events->push_front(model); } mCoreModelConnection->invokeToCore([this, events] { + beginResetModel(); + mList.clear(); for (auto &event : *events) { connectItem(event); mList.append(event); } + delete events; endResetModel(); setIsUpdating(false); emit modelUpdated(); diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 8a1361849..f1823437f 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -2086,13 +2086,13 @@ ChatDroppableTextArea - + chat_view_send_area_placeholder_text Say something… : placeholder text for sending message text area - + cannot_record_while_in_call_tooltip Cannot record a message while a call is ongoing @@ -2769,13 +2769,13 @@ Error ConferenceInfoCore - + information_popup_error_title "Erreur" Fehler - + information_popup_disconnected_account_message "Votre compte est déconnecté" Ihr Konto ist getrennt diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index 524f9dbb1..a4b7699a4 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -2079,13 +2079,13 @@ ChatDroppableTextArea - + chat_view_send_area_placeholder_text Say something… : placeholder text for sending message text area Say something… - + cannot_record_while_in_call_tooltip Cannot record a message while a call is ongoing Cannot record a message while a call is ongoing @@ -2754,13 +2754,13 @@ Only your correspondent can decrypt them. ConferenceInfoCore - + information_popup_error_title "Erreur" Error - + information_popup_disconnected_account_message "Votre compte est déconnecté" Your account is disconnected diff --git a/Linphone/data/languages/fr.ts b/Linphone/data/languages/fr.ts index 95dd82c87..f253589e7 100644 --- a/Linphone/data/languages/fr.ts +++ b/Linphone/data/languages/fr.ts @@ -2054,13 +2054,13 @@ ChatDroppableTextArea - + chat_view_send_area_placeholder_text Say something… : placeholder text for sending message text area Dites quelque chose… - + cannot_record_while_in_call_tooltip Cannot record a message while a call is ongoing Impossible d'enregistrer un message vocal pendant un appel @@ -2729,13 +2729,13 @@ en bout. Seul votre correspondant peut les déchiffrer. ConferenceInfoCore - + information_popup_error_title "Erreur" Erreur - + information_popup_disconnected_account_message "Votre compte est déconnecté" Votre compte est déconnecté