From 3fc3773ab848ff7fcfcb40c61e211ee13592f418 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 25 Jun 2010 14:57:42 -0700 Subject: EXT-7991 FIX Crash if exit before outfit autopopulate completes reviewed by Leyla --- indra/newview/llagentwearablesfetch.cpp | 2 +- indra/newview/llviewerinventory.cpp | 15 +++++++++++++++ indra/newview/llviewerinventory.h | 9 +++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 0a2f0e9399..d911d123f4 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -48,7 +48,7 @@ public: virtual ~LLOrderMyOutfitsOnDestroy() { - if (LLApp::isExiting()) + if (!LLApp::isRunning()) { llwarns << "called during shutdown, skipping" << llendl; return; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 3430f265ae..2bf05d5907 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -839,6 +839,21 @@ LLInventoryCallbackManager::~LLInventoryCallbackManager() sInstance = NULL; } +//static +void LLInventoryCallbackManager::destroyClass() +{ + if (sInstance) + { + for (callback_map_t::iterator it = sInstance->mMap.begin(), end_it = sInstance->mMap.end(); it != end_it; ++it) + { + // drop LLPointer reference to callback + it->second = NULL; + } + sInstance->mMap.clear(); + } +} + + U32 LLInventoryCallbackManager::registerCB(LLPointer cb) { if (cb.isNull()) diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index d0d3ad693e..dc3d3f7423 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -36,6 +36,7 @@ #include "llinventory.h" #include "llframetimer.h" #include "llwearable.h" +#include "llui.h" //for LLDestroyClass #include // boost::signals2::trackable @@ -299,8 +300,9 @@ private: // misc functions //void inventory_reliable_callback(void**, S32 status); -class LLInventoryCallbackManager +class LLInventoryCallbackManager : public LLDestroyClass { + friend LLDestroyClass; public: LLInventoryCallbackManager(); ~LLInventoryCallbackManager(); @@ -308,9 +310,12 @@ public: void fire(U32 callback_id, const LLUUID& item_id); U32 registerCB(LLPointer cb); private: - std::map > mMap; + typedef std::map > callback_map_t; + callback_map_t mMap; U32 mLastCallback; static LLInventoryCallbackManager *sInstance; + static void destroyClass(); + public: static bool is_instantiated() { return sInstance != NULL; } }; -- cgit v1.2.3