diff options
author | max nikolenko <maximnproductengine@lindenlab.com> | 2016-11-03 16:55:18 +0000 |
---|---|---|
committer | max nikolenko <maximnproductengine@lindenlab.com> | 2016-11-03 16:55:18 +0000 |
commit | 554f3a9e7a72be2db6344b56251ab8dded9dc75d (patch) | |
tree | 9d00a5f6ae5da8ab1dce6a150b4177c729f1dcb2 | |
parent | a471a8e400684e62ab63c21f9044194c0b3f23ac (diff) | |
parent | b6da37dc1949900332cf92b2ea8fa1078eff9635 (diff) |
Merged MAINT-6884 Issues with the Outfit Gallery and viewer crashes - out of memory crashes since VOB
-rw-r--r-- | indra/newview/lloutfitgallery.cpp | 37 | ||||
-rw-r--r-- | indra/newview/lloutfitgallery.h | 2 |
2 files changed, 37 insertions, 2 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 20be9962f1..bc1e2c5d59 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -235,6 +235,7 @@ void LLOutfitGallery::removeLastRow() { mRowCount--; mGalleryPanel->removeChild(mLastRowPanel); + mUnusedRowPanels.push_back(mLastRowPanel); mRowPanels.pop_back(); mLastRowPanel = mRowPanels.back(); } @@ -336,6 +337,7 @@ void LLOutfitGallery::removeFromLastRow(LLOutfitGalleryItem* item) { mItemPanels.back()->removeChild(item); mLastRowPanel->removeChild(mItemPanels.back()); + mUnusedItemPanels.push_back(mItemPanels.back()); mItemPanels.pop_back(); } @@ -375,7 +377,16 @@ LLPanel* LLOutfitGallery::buildItemPanel(int left) { LLPanel::Params lpparams; int top = 0; - LLPanel* lpanel = LLUICtrlFactory::create<LLPanel>(lpparams); + LLPanel* lpanel = NULL; + if(mUnusedItemPanels.empty()) + { + lpanel = LLUICtrlFactory::create<LLPanel>(lpparams); + } + else + { + lpanel = mUnusedItemPanels.back(); + mUnusedItemPanels.pop_back(); + } LLRect rect = LLRect(left, top + mItemHeight, left + mItemWidth + mItemHorizontalGap, top); lpanel->setRect(rect); lpanel->reshape(mItemWidth + mItemHorizontalGap, mItemHeight); @@ -388,7 +399,16 @@ LLPanel* LLOutfitGallery::buildItemPanel(int left) LLPanel* LLOutfitGallery::buildRowPanel(int left, int bottom) { LLPanel::Params sparams; - LLPanel* stack = LLUICtrlFactory::create<LLPanel>(sparams); + LLPanel* stack = NULL; + if(mUnusedRowPanels.empty()) + { + stack = LLUICtrlFactory::create<LLPanel>(sparams); + } + else + { + stack = mUnusedRowPanels.back(); + mUnusedRowPanels.pop_back(); + } moveRowPanel(stack, left, bottom); return stack; } @@ -418,6 +438,19 @@ LLOutfitGallery::~LLOutfitGallery() gInventory.removeObserver(mOutfitsObserver); } delete mOutfitsObserver; + + while (!mUnusedRowPanels.empty()) + { + LLPanel* panelp = mUnusedRowPanels.back(); + mUnusedRowPanels.pop_back(); + panelp->die(); + } + while (!mUnusedItemPanels.empty()) + { + LLPanel* panelp = mUnusedItemPanels.back(); + mUnusedItemPanels.pop_back(); + panelp->die(); + } } void LLOutfitGallery::setFilterSubString(const std::string& string) diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h index 140e68067b..b9fc10f015 100644 --- a/indra/newview/lloutfitgallery.h +++ b/indra/newview/lloutfitgallery.h @@ -158,6 +158,8 @@ private: void moveRowPanel(LLPanel* stack, int left, int bottom); std::vector<LLPanel*> mRowPanels; std::vector<LLPanel*> mItemPanels; + std::vector<LLPanel*> mUnusedRowPanels; + std::vector<LLPanel*> mUnusedItemPanels; std::vector<LLOutfitGalleryItem*> mItems; std::vector<LLOutfitGalleryItem*> mHiddenItems; LLScrollContainer* mScrollPanel; |