From 5dcc0606a8512159660c652cb25e7f29292f2df0 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 23 Feb 2024 04:18:03 +0200 Subject: Issue#880 Crash on a dead pointer in a chat session --- indra/newview/llconversationmodel.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 9ec4fb085b..fe5428d7f5 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -353,22 +353,20 @@ void LLConversationItemSession::clearParticipants() void LLConversationItemSession::clearAndDeparentModels() { - std::for_each(mChildren.begin(), mChildren.end(), - [](LLFolderViewModelItem* c) + for (LLFolderViewModelItem* child : mChildren) + { + if (child->getNumRefs() == 0) + { + // LLConversationItemParticipant can be created but not assigned to any view, + // it was waiting for an "add_participant" event to be processed + delete child; + } + else { - if (c->getNumRefs() == 0) - { - // LLConversationItemParticipant can be created but not assigned to any view, - // it was waiting for an "add_participant" event to be processed - delete c; - } - else - { - // Model is still assigned to some view/widget - c->setParent(NULL); - } + // Model is still assigned to some view/widget + child->setParent(NULL); } - ); + } mChildren.clear(); } -- cgit v1.2.3