summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2011-06-21 14:57:02 -0700
committerDon Kjer <don@lindenlab.com>2011-06-21 14:57:02 -0700
commit1e87fc43d7c07be618678aab6ee9f5511e593e92 (patch)
treef48984e703cab989c6ad5e0f27cc562a38dbbbdd /indra/newview/llviewermessage.cpp
parent4ba2a801489d59b39f0c0cd9b2fc7cc4fe396a8e (diff)
Fix for memory leak & extra inventory observers in start_new_inventory_observer. Reviewed by Richard
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-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 3832be727f..766df29a81 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -937,7 +937,6 @@ protected:
//one global instance to bind them
LLOpenTaskOffer* gNewInventoryObserver=NULL;
-
class LLNewInventoryHintObserver : public LLInventoryAddedObserver
{
protected:
@@ -947,6 +946,8 @@ protected:
}
};
+LLNewInventoryHintObserver* gNewInventoryHintObserver=NULL;
+
void start_new_inventory_observer()
{
if (!gNewInventoryObserver) //task offer observer
@@ -963,7 +964,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