diff options
| author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2016-11-03 17:28:14 +0200 | 
|---|---|---|
| committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2016-11-03 17:28:14 +0200 | 
| commit | b6da37dc1949900332cf92b2ea8fa1078eff9635 (patch) | |
| tree | b223264651b0baf1b28b26f58ee720264ed0d1ce | |
| parent | a210ae50b03bae60e825b76c200980a31c9c93d8 (diff) | |
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; | 
