diff options
author | Rick Pasetto <rick@lindenlab.com> | 2009-10-28 09:32:48 -0700 |
---|---|---|
committer | Rick Pasetto <rick@lindenlab.com> | 2009-10-28 09:32:48 -0700 |
commit | c4992e30654775c54e3dc4fb583375ec079b23a4 (patch) | |
tree | 31af4a671d5f0b238ffe99a141967bfc977cd69b /indra/newview/llinventorymodel.cpp | |
parent | 88166e7d222bf18fc0324714dc44efef161bc409 (diff) | |
parent | ea5a60c80f0243a7e5a6a7fd8357e7c3cd6b5d4d (diff) |
Merge from remote repo
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index d5a527773c..1d7cbde0d5 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -176,12 +176,21 @@ LLInventoryModel::LLInventoryModel() // Destroys the object LLInventoryModel::~LLInventoryModel() { + cleanupInventory(); +} + +void LLInventoryModel::cleanupInventory() +{ empty(); - for (observer_list_t::iterator iter = mObservers.begin(); - iter != mObservers.end(); ++iter) + // Deleting one observer might erase others from the list, so always pop off the front + while (!mObservers.empty()) { - delete *iter; + observer_list_t::iterator iter = mObservers.begin(); + LLInventoryObserver* observer = *iter; + mObservers.erase(iter); + delete observer; } + mObservers.clear(); } // This is a convenience function to check if one object has a parent |