Skip to content
Snippets Groups Projects
Commit 79542fe8 authored by Loren Shih's avatar Loren Shih
Browse files

EXT-4154 : Memory leak from FetchObservers in AppearanceSP

Member observers of LLSidepanelAppearance are now deleted appropriately.
parent 78cb4204
No related branches found
No related tags found
No related merge requests found
...@@ -62,6 +62,7 @@ class LLCurrentlyWornFetchObserver : public LLInventoryFetchObserver ...@@ -62,6 +62,7 @@ class LLCurrentlyWornFetchObserver : public LLInventoryFetchObserver
{ {
mPanel->inventoryFetched(); mPanel->inventoryFetched();
gInventory.removeObserver(this); gInventory.removeObserver(this);
delete this;
} }
private: private:
LLSidepanelAppearance *mPanel; LLSidepanelAppearance *mPanel;
...@@ -94,14 +95,12 @@ LLSidepanelAppearance::LLSidepanelAppearance() : ...@@ -94,14 +95,12 @@ LLSidepanelAppearance::LLSidepanelAppearance() :
mLookInfo(NULL), mLookInfo(NULL),
mCurrOutfitPanel(NULL) mCurrOutfitPanel(NULL)
{ {
//LLUICtrlFactory::getInstance()->buildPanel(this, "panel_appearance.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
mFetchWorn = new LLCurrentlyWornFetchObserver(this);
mOutfitRenameWatcher = new LLWatchForOutfitRenameObserver(this);
} }
LLSidepanelAppearance::~LLSidepanelAppearance() LLSidepanelAppearance::~LLSidepanelAppearance()
{ {
gInventory.removeObserver(mOutfitRenameWatcher);
delete mOutfitRenameWatcher;
} }
// virtual // virtual
...@@ -156,6 +155,7 @@ BOOL LLSidepanelAppearance::postBuild() ...@@ -156,6 +155,7 @@ BOOL LLSidepanelAppearance::postBuild()
mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook"); mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook");
mOutfitRenameWatcher = new LLWatchForOutfitRenameObserver(this);
gInventory.addObserver(mOutfitRenameWatcher); gInventory.addObserver(mOutfitRenameWatcher);
return TRUE; return TRUE;
...@@ -389,16 +389,17 @@ void LLSidepanelAppearance::fetchInventory() ...@@ -389,16 +389,17 @@ void LLSidepanelAppearance::fetchInventory()
} }
} }
mFetchWorn->fetchItems(ids); LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(this);
fetch_worn->fetchItems(ids);
// If no items to be fetched, done will never be triggered. // If no items to be fetched, done will never be triggered.
// TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition. // TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition.
if (mFetchWorn->isEverythingComplete()) if (fetch_worn->isEverythingComplete())
{ {
mFetchWorn->done(); fetch_worn->done();
} }
else else
{ {
gInventory.addObserver(mFetchWorn); gInventory.addObserver(fetch_worn);
} }
} }
......
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