Skip to content
Snippets Groups Projects
Commit d077558e authored by Andrey Kleshchev's avatar Andrey Kleshchev
Browse files

SL-19686 Fix memory leak

parent 451a89d7
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -134,6 +134,7 @@ class LLInventoryGallery : public LLPanel, public LLEditMenuHandler
void setSearchType(LLInventoryFilter::ESearchType type);
LLInventoryFilter::ESearchType getSearchType() { return mSearchType; }
bool areViewsInitialized();
bool hasDescendents(const LLUUID& cat_id);
bool hasVisibleItems();
void handleModifiedFilter();
......
......@@ -2386,7 +2386,6 @@ void LLPanelMainInventory::updateCombinationVisibility()
bool is_gallery_empty = !mCombinationGalleryPanel->hasVisibleItems();
bool show_inv_pane = mCombinationInventoryPanel->hasVisibleItems() || is_gallery_empty || mForceShowInvLayout;
mCombinationGalleryLayoutPanel->setVisible(!is_gallery_empty);
mCombinationGalleryPanel->setVisible(true); // to make sure root updates are getting processed
mCombinationListLayoutPanel->setVisible(show_inv_pane);
mCombinationInventoryPanel->getRootFolder()->setForceArrange(!show_inv_pane);
if(mCombinationInventoryPanel->hasVisibleItems())
......@@ -2402,7 +2401,7 @@ void LLPanelMainInventory::updateCombinationVisibility()
if (mReshapeInvLayout
&& show_inv_pane
&& mCombinationGalleryPanel->hasVisibleItems()
&& (mCombinationGalleryPanel->hasVisibleItems() || mCombinationGalleryPanel->areViewsInitialized())
&& mCombinationInventoryPanel->areViewsInitialized())
{
mReshapeInvLayout = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment