diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 923a66ee8e344f7ca26d6460670430be56d0782e..840fa542bd62067f58a1a1923f8893f5fa809b35 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1350,7 +1350,9 @@ bool LLAppViewer::cleanup() // Destroy the UI if( gViewerWindow) gViewerWindow->shutdownViews(); - + + gInventory.cleanupInventory(); + // Clean up selection managers after UI is destroyed, as UI may be observing them. // Clean up before GL is shut down because we might be holding on to objects with texture references LLSelectMgr::cleanupGlobals(); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index d5a527773cc04567c2b34fd7986025a96486b21e..e49be83fbc7c25ab35446220b65a97a37da55bc7 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -175,13 +175,20 @@ LLInventoryModel::LLInventoryModel() // Destroys the object LLInventoryModel::~LLInventoryModel() +{ + cleanupInventory(); +} + +void LLInventoryModel::cleanupInventory() { empty(); for (observer_list_t::iterator iter = mObservers.begin(); - iter != mObservers.end(); ++iter) + iter != mObservers.end(); ) { - delete *iter; + LLInventoryObserver* observer = *iter++; + delete observer; } + mObservers.clear(); } // This is a convenience function to check if one object has a parent diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 7d4f3372e979e5ea8b4998f736a197d05aa0ce45..d51460b374c67aea7144e8b287fa63c596189cc9 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -112,7 +112,9 @@ class LLInventoryModel // construction & destruction LLInventoryModel(); ~LLInventoryModel(); - + + void cleanupInventory(); + class fetchInventoryResponder : public LLHTTPClient::Responder { public: