summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorygallery.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-06-15 22:50:41 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-06-15 23:08:31 +0300
commitd077558ed7fac01aae8d5a1670f4d0764ec6fbcb (patch)
treecfbe74d3c56f3e58faa91e94aaa5b06d4e69bb97 /indra/newview/llinventorygallery.cpp
parent451a89d75b78ccf0313f5dadbe6f380136500fda (diff)
SL-19686 Fix memory leak
Diffstat (limited to 'indra/newview/llinventorygallery.cpp')
-rw-r--r--indra/newview/llinventorygallery.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index 083dfdc65e..caf93b924c 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -158,6 +158,13 @@ LLInventoryGallery::~LLInventoryGallery()
mUnusedItemPanels.pop_back();
panelp->die();
}
+ while (!mHiddenItems.empty())
+ {
+ LLPanel* panelp = mHiddenItems.back();
+ mHiddenItems.pop_back();
+ panelp->die();
+ }
+
if (gInventory.containsObserver(mCategoriesObserver))
{
@@ -490,6 +497,7 @@ void LLInventoryGallery::removeFromGalleryLast(LLInventoryGalleryItem* item)
if(item->isHidden())
{
mHiddenItems.pop_back();
+ // Note: item still exists!!!
return;
}
int n_prev = mItemsAddedCount;
@@ -519,6 +527,7 @@ void LLInventoryGallery::removeFromGalleryMiddle(LLInventoryGalleryItem* item)
if(item->isHidden())
{
mHiddenItems.erase(std::remove(mHiddenItems.begin(), mHiddenItems.end(), item), mHiddenItems.end());
+ // item still exists and needs to be deleted or used!!!
return;
}
int n = mItemIndexMap[item];
@@ -859,6 +868,7 @@ void LLInventoryGallery::updateRemovedItem(LLUUID item_id)
// kill removed item
if (item != NULL)
{
+ // Todo: instead of deleting, store somewhere to reuse later
item->die();
}
}
@@ -1876,6 +1886,11 @@ BOOL LLInventoryGallery::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
return handled;
}
+bool LLInventoryGallery::areViewsInitialized()
+{
+ return mGalleryCreated && mItemBuildQuery.empty();
+}
+
bool LLInventoryGallery::hasDescendents(const LLUUID& cat_id)
{
LLInventoryModel::cat_array_t* cats;