From 28f4e9b352a34d4fe551e13d37d3967b41bd5893 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Mon, 14 Sep 2026 12:35:52 +0300 Subject: #6310 Harden inventory view lifetime handling --- indra/llui/llfolderviewitem.cpp | 17 +++++++++++++++-- indra/newview/llinventorypanel.cpp | 5 +++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index c8ef421677..7c51574fc2 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -234,7 +234,11 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) // Destroys the object LLFolderViewItem::~LLFolderViewItem() { - mViewModelItem = NULL; + if (mViewModelItem) + { + mViewModelItem->setFolderViewItem(nullptr); + mViewModelItem = nullptr; + } gFocusMgr.removeKeyboardFocusWithoutCallback(this); } @@ -356,7 +360,12 @@ bool LLFolderViewItem::isPotentiallyVisible(S32 filter_generation) void LLFolderViewItem::refresh() { - LLFolderViewModelItem& vmi = *getViewModelItem(); + LLFolderViewModelItem* vmi_ptr = getViewModelItem(); + if (!vmi_ptr) + { + return; + } + LLFolderViewModelItem& vmi = *vmi_ptr; mLabel = utf8str_to_wstring(vmi.getDisplayName()); mLabelFontBuffer.reset(); @@ -387,6 +396,10 @@ void LLFolderViewItem::refresh() void LLFolderViewItem::refreshSuffix() { LLFolderViewModelItem const* vmi = getViewModelItem(); + if (!vmi) + { + return; + } // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 301a0a0cc9..92cf302a8d 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -602,8 +602,8 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve if (model_item && view_item && viewmodel_item) { const LLUUID idp = viewmodel_item->getUUID(); - view_item->destroyView(); removeItemID(idp); + view_item->destroyView(); } LLInventoryObject const* objectp = mInventory->getObject(item_id); @@ -709,6 +709,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve LLFolderViewModelItem* old_parent_vmi = old_parent->getViewModelItem(); LLFolderViewModelItemInventory* viewmodel_folder = static_cast(old_parent_vmi); LLFolderViewFolder* new_parent = getFolderByID(model_item->getParentUUID()); + const bool was_favorite = view_item->isFavorite(); if (old_parent != new_parent // Item has been moved. && (new_parent != NULL || !isInRootContent(item_id, view_item)) // item is not or shouldn't be in root content @@ -748,7 +749,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve old_parent_vmi->dirtyDescendantsFilter(); } - if (view_item->isFavorite()) + if (was_favorite) { if (old_parent) { -- cgit v1.3