diff options
Diffstat (limited to 'indra/newview/llconversationmodel.cpp')
-rw-r--r-- | indra/newview/llconversationmodel.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index fbdf08d8aa..4cfde21e32 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -350,16 +350,24 @@ void LLConversationItemSession::clearParticipants() } -void LLConversationItemSession::deleteParticipantModels() -{ - // Make sure that no views exist before use and that view-owned items were removed! - // - // Normally we are not supposed to delete models directly, they should be - // owned by views and this action will result in crashes, but LLParticipantList - // creates models separately from views (it probably shouldn't) and then those - // models wait for idle cycles to be assigned to view. - // this code is meant to delete 'waiting' models - std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); +void LLConversationItemSession::clearAndDeparentModels() +{ + std::for_each(mChildren.begin(), mChildren.end(), + [](LLFolderViewModelItem* c) + { + 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); + } + } + ); mChildren.clear(); } |