summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2011-06-21 15:02:34 -0700
committerDon Kjer <don@lindenlab.com>2011-06-21 15:02:34 -0700
commit969a6f9be2eadcdc93fec3ace3be06a8cdbc509d (patch)
tree2e35b8785017f515d835c6d3a2012430efb2ce14 /indra/newview
parent9afc77ba0affee16d9dbee312417aaef541eabba (diff)
Fix for memory leak & extra inventory observers in start_new_inventory_observer. Reviewed by Richard
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llviewermessage.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 7ab335314a..b840991bbc 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -936,7 +936,6 @@ protected:
//one global instance to bind them
LLOpenTaskOffer* gNewInventoryObserver=NULL;
-
class LLNewInventoryHintObserver : public LLInventoryAddedObserver
{
protected:
@@ -946,6 +945,8 @@ protected:
}
};
+LLNewInventoryHintObserver* gNewInventoryHintObserver=NULL;
+
void start_new_inventory_observer()
{
if (!gNewInventoryObserver) //task offer observer
@@ -962,7 +963,12 @@ void start_new_inventory_observer()
gInventory.addObserver(gInventoryMoveObserver);
}
- gInventory.addObserver(new LLNewInventoryHintObserver());
+ if (!gNewInventoryHintObserver)
+ {
+ // Observer is deleted by gInventory
+ gNewInventoryHintObserver = new LLNewInventoryHintObserver();
+ gInventory.addObserver(gNewInventoryHintObserver);
+ }
}
class LLDiscardAgentOffer : public LLInventoryFetchItemsObserver