From 6d27a9e28d0711c78066f3f4977cd92069090357 Mon Sep 17 00:00:00 2001
From: "Eric M. Tulla (BigPapi)" <tulla@lindenlab.com>
Date: Fri, 8 Jan 2010 19:28:23 -0500
Subject: [PATCH] EXT-4038: Typo fix & proper handling of autopopulation if
 library clothing already imported -Reviewed by vir

---
 indra/newview/llagentwearables.cpp | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 63e12bd468..10a2dd132a 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -2291,15 +2291,16 @@ class LLLibraryOutfitsCopyDone: public LLInventoryCallback
 {
 public:
 	LLLibraryOutfitsCopyDone(LLLibraryOutfitsFetch * fetcher):
-	mFireCount(0), mLibraryOutftifsFetcher(fetcher)
+	mFireCount(0), mLibraryOutfitsFetcher(fetcher)
 	{
 	}
 	
 	virtual ~LLLibraryOutfitsCopyDone()
 	{
-		if (mLibraryOutftifsFetcher)
+		if (mLibraryOutfitsFetcher)
 		{
-			mLibraryOutftifsFetcher->importedFolderFetch();
+			gInventory.addObserver(mLibraryOutfitsFetcher);
+			mLibraryOutfitsFetcher->done();
 		}
 	}
 	
@@ -2309,17 +2310,16 @@ public:
 	}
 private:
 	U32 mFireCount;
-	LLLibraryOutfitsFetch * mLibraryOutftifsFetcher;
+	LLLibraryOutfitsFetch * mLibraryOutfitsFetcher;
 };
 
 void LLLibraryOutfitsFetch::libraryDone(void)
 {
-	gInventory.removeObserver(this);
 	// Copy the clothing folders from the library into the imported clothing folder if necessary.
-	LLPointer<LLInventoryCallback> copy_waiter = new LLLibraryOutfitsCopyDone(this);
-	
 	if (mImportedClothingID == LLUUID::null)
 	{
+		gInventory.removeObserver(this);
+		LLPointer<LLInventoryCallback> copy_waiter = new LLLibraryOutfitsCopyDone(this);
 		mImportedClothingID = gInventory.createNewCategory(mClothingID,
 														   LLFolderType::FT_NONE,
 														   mImportedClothingName);
@@ -2334,6 +2334,11 @@ void LLLibraryOutfitsFetch::libraryDone(void)
 			LLAppearanceManager::getInstance()->shallowCopyCategory(iter->first, folder_id, copy_waiter);
 		}
 	}
+	else
+	{
+		// Skip straight to fetching the contents of the imported folder
+		importedFolderFetch();
+	}
 }
 
 void LLLibraryOutfitsFetch::importedFolderFetch(void)
@@ -2344,8 +2349,6 @@ void LLLibraryOutfitsFetch::importedFolderFetch(void)
 	
 	mCompleteFolders.clear();
 	
-	gInventory.addObserver(this);
-	
 	fetchDescendents(folders);
 	if (isEverythingComplete())
 	{
-- 
GitLab