From 449de8e6085c1ddb7a4bd9dcd835aecbf45a7d11 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Tue, 22 Jun 2010 16:34:31 -0400
Subject: [PATCH] EXT-3616 FIX - avoid bailing out of outfit population too
 soon.

---
 indra/newview/llagentwearablesfetch.cpp | 28 +++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp
index 931aba1d416..0a2f0e9399d 100644
--- a/indra/newview/llagentwearablesfetch.cpp
+++ b/indra/newview/llagentwearablesfetch.cpp
@@ -48,6 +48,12 @@ class LLOrderMyOutfitsOnDestroy: public LLInventoryCallback
 
 	virtual ~LLOrderMyOutfitsOnDestroy()
 	{
+		if (LLApp::isExiting())
+		{
+			llwarns << "called during shutdown, skipping" << llendl;
+			return;
+		}
+		
 		const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
 		if (my_outfits_id.isNull()) return;
 
@@ -241,6 +247,8 @@ LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const LLUUID& my_outfits_id) :
 	mCurrFetchStep(LOFS_FOLDER), 
 	mOutfitsPopulated(false) 
 {
+	llinfos << "created" << llendl;
+
 	mMyOutfitsID = LLUUID::null;
 	mClothingID = LLUUID::null;
 	mLibraryClothingID = LLUUID::null;
@@ -250,10 +258,13 @@ LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const LLUUID& my_outfits_id) :
 
 LLLibraryOutfitsFetch::~LLLibraryOutfitsFetch()
 {
+	llinfos << "destroyed" << llendl;
 }
 
 void LLLibraryOutfitsFetch::done()
 {
+	llinfos << "start" << llendl;
+
 	// Delay this until idle() routine, since it's a heavy operation and
 	// we also can't have it run within notifyObservers.
 	doOnIdleOneTime(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this));
@@ -262,6 +273,8 @@ void LLLibraryOutfitsFetch::done()
 
 void LLLibraryOutfitsFetch::doneIdle()
 {
+	llinfos << "start" << llendl;
+
 	gInventory.addObserver(this); // Add this back in since it was taken out during ::done()
 	
 	switch (mCurrFetchStep)
@@ -302,6 +315,8 @@ void LLLibraryOutfitsFetch::doneIdle()
 
 void LLLibraryOutfitsFetch::folderDone()
 {
+	llinfos << "start" << llendl;
+
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
 	gInventory.collectDescendents(mMyOutfitsID, cat_array, wearable_array, 
@@ -309,8 +324,7 @@ void LLLibraryOutfitsFetch::folderDone()
 	
 	// Early out if we already have items in My Outfits
 	// except the case when My Outfits contains just initial outfit
-	if (cat_array.count() > 1 ||
-		cat_array.count() == 1 && cat_array[0]->getUUID() != LLAppearanceMgr::getInstance()->getBaseOutfitUUID())
+	if (cat_array.count() > 1)
 	{
 		mOutfitsPopulated = true;
 		return;
@@ -348,6 +362,8 @@ void LLLibraryOutfitsFetch::folderDone()
 
 void LLLibraryOutfitsFetch::outfitsDone()
 {
+	llinfos << "start" << llendl;
+
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
 	uuid_vec_t folders;
@@ -425,6 +441,8 @@ class LLLibraryOutfitsCopyDone: public LLInventoryCallback
 // Copy the clothing folders from the library into the imported clothing folder
 void LLLibraryOutfitsFetch::libraryDone()
 {
+	llinfos << "start" << llendl;
+
 	if (mImportedClothingID != LLUUID::null)
 	{
 		// Skip straight to fetching the contents of the imported folder
@@ -480,6 +498,8 @@ void LLLibraryOutfitsFetch::libraryDone()
 
 void LLLibraryOutfitsFetch::importedFolderFetch()
 {
+	llinfos << "start" << llendl;
+
 	// Fetch the contents of the Imported Clothing Folder
 	uuid_vec_t folders;
 	folders.push_back(mImportedClothingID);
@@ -495,6 +515,8 @@ void LLLibraryOutfitsFetch::importedFolderFetch()
 
 void LLLibraryOutfitsFetch::importedFolderDone()
 {
+	llinfos << "start" << llendl;
+
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
 	uuid_vec_t folders;
@@ -525,6 +547,8 @@ void LLLibraryOutfitsFetch::importedFolderDone()
 
 void LLLibraryOutfitsFetch::contentsDone()
 {		
+	llinfos << "start" << llendl;
+
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
 	
-- 
GitLab