From 99d2ae5e021310ca09af4f0377c5609d007ee52e Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Fri, 23 Oct 2020 20:30:09 +0300
Subject: SL-14190 sAvatarDictionary was not used

---
 indra/llappearance/llavatarappearance.cpp        |  4 ++--
 indra/llappearance/llavatarappearancedefines.cpp | 14 +++++---------
 indra/llappearance/llavatarappearancedefines.h   |  8 ++++----
 indra/llappearance/lltexlayer.cpp                |  2 +-
 indra/llappearance/llwearable.cpp                |  2 +-
 indra/llappearance/llwearabledata.cpp            |  2 +-
 6 files changed, 14 insertions(+), 18 deletions(-)

(limited to 'indra/llappearance')

diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index f7fbb6fda1..c4c3345dec 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -202,7 +202,7 @@ LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) :
 		mBakedTextureDatas[i].mIsLoaded = false;
 		mBakedTextureDatas[i].mIsUsed = false;
 		mBakedTextureDatas[i].mMaskTexName = 0;
-		mBakedTextureDatas[i].mTextureIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((LLAvatarAppearanceDefines::EBakedTextureIndex)i);
+		mBakedTextureDatas[i].mTextureIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->bakedToLocalTextureIndex((LLAvatarAppearanceDefines::EBakedTextureIndex)i);
 	}
 }
 
@@ -999,7 +999,7 @@ BOOL LLAvatarAppearance::loadAvatar()
 	{
 		LLAvatarXmlInfo::LLAvatarMorphInfo *info = *iter;
 
-		EBakedTextureIndex baked = LLAvatarAppearanceDictionary::findBakedByRegionName(info->mRegion); 
+		EBakedTextureIndex baked = LLAvatarAppearanceDictionary::getInstance()->findBakedByRegionName(info->mRegion);
 		if (baked != BAKED_NUM_INDICES)
 		{
 			LLVisualParam* morph_param;
diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp
index c72943bb82..0039f98af8 100644
--- a/indra/llappearance/llavatarappearancedefines.cpp
+++ b/indra/llappearance/llavatarappearancedefines.cpp
@@ -258,19 +258,17 @@ LLAvatarAppearanceDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
 	}
 }
 
-// static
 ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index)
 {
-	return LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(index)->mTextureIndex;
+	return getBakedTexture(index)->mTextureIndex;
 }
 
-// static
 EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(std::string name)
 {
 	U8 index = 0;
 	while (index < BAKED_NUM_INDICES)
 	{
-		const BakedEntry *be = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
+		const BakedEntry *be = getBakedTexture((EBakedTextureIndex) index);
 		if (be && be->mName.compare(name) == 0)
 		{
 			// baked texture found
@@ -282,16 +280,15 @@ EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(std::stri
 	return BAKED_NUM_INDICES;
 }
 
-// static 
 EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByImageName(std::string name)
 {
 	U8 index = 0;
 	while (index < BAKED_NUM_INDICES)
 	{
-		const BakedEntry *be = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
+		const BakedEntry *be = getBakedTexture((EBakedTextureIndex) index);
 		if (be)
 		{
-			const TextureEntry *te = LLAvatarAppearanceDictionary::getInstance()->getTexture(be->mTextureIndex);
+			const TextureEntry *te = getTexture(be->mTextureIndex);
 			if (te && te->mDefaultImageName.compare(name) == 0)
 			{
 				// baked texture found
@@ -304,10 +301,9 @@ EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByImageName(std::strin
 	return BAKED_NUM_INDICES;
 }
 
-// static
 LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIndex index )
 {
-	return getInstance()->getTexture(index)->mWearableType;
+	return getTexture(index)->mWearableType;
 }
 
 // static
diff --git a/indra/llappearance/llavatarappearancedefines.h b/indra/llappearance/llavatarappearancedefines.h
index 5663d24293..18d80b3e2e 100644
--- a/indra/llappearance/llavatarappearancedefines.h
+++ b/indra/llappearance/llavatarappearancedefines.h
@@ -235,14 +235,14 @@ public:
 	//--------------------------------------------------------------------
 public:
 	// Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED
-	static ETextureIndex 		bakedToLocalTextureIndex(EBakedTextureIndex t);
+	ETextureIndex 		bakedToLocalTextureIndex(EBakedTextureIndex t);
 
 	// find a baked texture index based on its name
-	static EBakedTextureIndex 	findBakedByRegionName(std::string name);
-	static EBakedTextureIndex 	findBakedByImageName(std::string name);
+	EBakedTextureIndex 	findBakedByRegionName(std::string name);
+	EBakedTextureIndex 	findBakedByImageName(std::string name);
 
 	// Given a texture entry, determine which wearable type owns it.
-	static LLWearableType::EType 		getTEWearableType(ETextureIndex index);
+	LLWearableType::EType 		getTEWearableType(ETextureIndex index);
 
 	static BOOL							isBakedImageId(const LLUUID& id);
 	static EBakedTextureIndex			assetIdToBakedTextureIndex(const LLUUID& id);
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index c90b11ae71..248214e7bc 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -979,7 +979,7 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const
 
 		return type;
 	}
-	return LLAvatarAppearanceDictionary::getTEWearableType(te);
+	return LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(te);
 }
 
 LLTexLayerInterface::ERenderPass LLTexLayerInterface::getRenderPass() const
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index 6079913a8e..d12d166dca 100644
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -606,7 +606,7 @@ void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
 	// Deep copy of src (copies only those tes that are current, filling in defaults where needed)
 	for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
 	{
-		if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType)
+		if (LLAvatarAppearanceDictionary::getInstance()->getTEWearableType((ETextureIndex) te) == mType)
 		{
 			te_map_t::const_iterator iter = src.find(te);
 			LLUUID image_id;
diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp
index 2bf3b9085b..bead125e2d 100644
--- a/indra/llappearance/llwearabledata.cpp
+++ b/indra/llappearance/llwearabledata.cpp
@@ -339,7 +339,7 @@ U32 LLWearableData::getWearableCount(const LLWearableType::EType type) const
 
 U32 LLWearableData::getWearableCount(const U32 tex_index) const
 {
-	const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
+	const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
 	return getWearableCount(wearable_type);
 }
 
-- 
cgit v1.2.3


From 5e7a0a963e3549ee61339111b7dfce6b6420d0bc Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Tue, 3 Nov 2020 22:12:39 +0200
Subject: SL-14190 moved sAvatarDictionary

---
 indra/llappearance/llavatarappearance.cpp        | 30 +++++++++++++++---------
 indra/llappearance/llavatarappearance.h          |  4 ++++
 indra/llappearance/llavatarappearancedefines.cpp |  4 ++--
 indra/llappearance/llavatarappearancedefines.h   | 11 +++++----
 indra/llappearance/lltexlayer.cpp                |  6 ++---
 indra/llappearance/llwearable.cpp                |  4 ++--
 indra/llappearance/llwearabledata.cpp            |  4 ++--
 7 files changed, 38 insertions(+), 25 deletions(-)

(limited to 'indra/llappearance')

diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index c4c3345dec..4d36759167 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -175,6 +175,7 @@ LLXmlTree LLAvatarAppearance::sXMLTree;
 LLXmlTree LLAvatarAppearance::sSkeletonXMLTree;
 LLAvatarSkeletonInfo* LLAvatarAppearance::sAvatarSkeletonInfo = NULL;
 LLAvatarAppearance::LLAvatarXmlInfo* LLAvatarAppearance::sAvatarXmlInfo = NULL;
+LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* LLAvatarAppearance::sAvatarDictionary = NULL;
 
 
 LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) :
@@ -202,7 +203,7 @@ LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) :
 		mBakedTextureDatas[i].mIsLoaded = false;
 		mBakedTextureDatas[i].mIsUsed = false;
 		mBakedTextureDatas[i].mMaskTexName = 0;
-		mBakedTextureDatas[i].mTextureIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->bakedToLocalTextureIndex((LLAvatarAppearanceDefines::EBakedTextureIndex)i);
+		mBakedTextureDatas[i].mTextureIndex = sAvatarDictionary->bakedToLocalTextureIndex((LLAvatarAppearanceDefines::EBakedTextureIndex)i);
 	}
 }
 
@@ -215,8 +216,8 @@ void LLAvatarAppearance::initInstance()
 	mRoot = createAvatarJoint();
 	mRoot->setName( "mRoot" );
 
-	for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().begin();
-		 iter != LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().end();
+	for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = sAvatarDictionary->getMeshEntries().begin();
+		 iter != sAvatarDictionary->getMeshEntries().end();
 		 ++iter)
 	{
 		const EMeshIndex mesh_index = iter->first;
@@ -261,8 +262,8 @@ void LLAvatarAppearance::initInstance()
 	//-------------------------------------------------------------------------
 	// associate baked textures with meshes
 	//-------------------------------------------------------------------------
-	for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().begin();
-		 iter != LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().end();
+	for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = sAvatarDictionary->getMeshEntries().begin();
+		 iter != sAvatarDictionary->getMeshEntries().end();
 		 ++iter)
 	{
 		const EMeshIndex mesh_index = iter->first;
@@ -336,6 +337,12 @@ void LLAvatarAppearance::initClass()
 //static
 void LLAvatarAppearance::initClass(const std::string& avatar_file_name_arg, const std::string& skeleton_file_name_arg)
 {
+    // init dictionary (don't repeat on second login attempt)
+    if (!sAvatarDictionary)
+    {
+        sAvatarDictionary = new LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary();
+    }
+
 	std::string avatar_file_name;
 
     if (!avatar_file_name_arg.empty())
@@ -453,7 +460,8 @@ void LLAvatarAppearance::initClass(const std::string& avatar_file_name_arg, cons
 void LLAvatarAppearance::cleanupClass()
 {
 	delete_and_clear(sAvatarXmlInfo);
-	// *TODO: What about sAvatarSkeletonInfo ???
+    delete_and_clear(sAvatarDictionary);
+    delete_and_clear(sAvatarSkeletonInfo);
 	sSkeletonXMLTree.cleanup();
 	sXMLTree.cleanup();
 }
@@ -999,7 +1007,7 @@ BOOL LLAvatarAppearance::loadAvatar()
 	{
 		LLAvatarXmlInfo::LLAvatarMorphInfo *info = *iter;
 
-		EBakedTextureIndex baked = LLAvatarAppearanceDictionary::getInstance()->findBakedByRegionName(info->mRegion);
+		EBakedTextureIndex baked = sAvatarDictionary->findBakedByRegionName(info->mRegion);
 		if (baked != BAKED_NUM_INDICES)
 		{
 			LLVisualParam* morph_param;
@@ -1135,8 +1143,8 @@ BOOL LLAvatarAppearance::loadMeshNodes()
 			switch(lod)
 			  case 0:
 				mesh = &mHairMesh0; */
-		for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator mesh_iter = LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().begin();
-			 mesh_iter != LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().end();
+		for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator mesh_iter = sAvatarDictionary->getMeshEntries().begin();
+			 mesh_iter != sAvatarDictionary->getMeshEntries().end();
 			 ++mesh_iter)
 		{
 			const EMeshIndex mesh_index = mesh_iter->first;
@@ -1264,8 +1272,8 @@ BOOL LLAvatarAppearance::loadLayersets()
 
 			// scan baked textures and associate the layerset with the appropriate one
 			EBakedTextureIndex baked_index = BAKED_NUM_INDICES;
-			for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
-				 baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
+			for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
+				 baked_iter != sAvatarDictionary->getBakedTextures().end();
 				 ++baked_iter)
 			{
 				const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index 6a4dbf3726..d16aeccf0d 100644
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -255,6 +255,7 @@ public:
 public:
 	virtual void	updateMeshTextures() = 0;
 	virtual void	dirtyMesh() = 0; // Dirty the avatar mesh
+	static const LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary *getDictionary() { return sAvatarDictionary; }
 protected:
 	virtual void	dirtyMesh(S32 priority) = 0; // Dirty the avatar mesh, with priority
 
@@ -263,6 +264,9 @@ protected:
 	polymesh_map_t 									mPolyMeshes;
 	avatar_joint_list_t								mMeshLOD;
 
+    // mesh entries and backed textures
+    static LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* sAvatarDictionary;
+
 /**                    Meshes
  **                                                                            **
  *******************************************************************************/
diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp
index 0039f98af8..9398ce3822 100644
--- a/indra/llappearance/llavatarappearancedefines.cpp
+++ b/indra/llappearance/llavatarappearancedefines.cpp
@@ -258,7 +258,7 @@ LLAvatarAppearanceDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
 	}
 }
 
-ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index)
+ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index) const
 {
 	return getBakedTexture(index)->mTextureIndex;
 }
@@ -301,7 +301,7 @@ EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByImageName(std::strin
 	return BAKED_NUM_INDICES;
 }
 
-LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIndex index )
+LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIndex index ) const
 {
 	return getTexture(index)->mWearableType;
 }
diff --git a/indra/llappearance/llavatarappearancedefines.h b/indra/llappearance/llavatarappearancedefines.h
index 18d80b3e2e..8968187531 100644
--- a/indra/llappearance/llavatarappearancedefines.h
+++ b/indra/llappearance/llavatarappearancedefines.h
@@ -143,13 +143,14 @@ typedef std::vector<LLWearableType::EType> wearables_vec_t;
 // 
 // This holds const data - it is initialized once and the contents never change after that.
 //------------------------------------------------------------------------
-class LLAvatarAppearanceDictionary : public LLSingleton<LLAvatarAppearanceDictionary>
+class LLAvatarAppearanceDictionary
 {
 	//--------------------------------------------------------------------
 	// Constructors and Destructors
 	//--------------------------------------------------------------------
-	LLSINGLETON(LLAvatarAppearanceDictionary);
-	virtual ~LLAvatarAppearanceDictionary();
+public:
+	LLAvatarAppearanceDictionary();
+	~LLAvatarAppearanceDictionary();
 private:
 	void createAssociations();
 	
@@ -235,14 +236,14 @@ public:
 	//--------------------------------------------------------------------
 public:
 	// Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED
-	ETextureIndex 		bakedToLocalTextureIndex(EBakedTextureIndex t);
+	ETextureIndex 		bakedToLocalTextureIndex(EBakedTextureIndex t) const;
 
 	// find a baked texture index based on its name
 	EBakedTextureIndex 	findBakedByRegionName(std::string name);
 	EBakedTextureIndex 	findBakedByImageName(std::string name);
 
 	// Given a texture entry, determine which wearable type owns it.
-	LLWearableType::EType 		getTEWearableType(ETextureIndex index);
+	LLWearableType::EType 		getTEWearableType(ETextureIndex index) const;
 
 	static BOOL							isBakedImageId(const LLUUID& id);
 	static EBakedTextureIndex			assetIdToBakedTextureIndex(const LLUUID& id);
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 248214e7bc..e5039141de 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -728,8 +728,8 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
 			/* if ("upper_shirt" == local_texture_name)
 				mLocalTexture = TEX_UPPER_SHIRT; */
 			mLocalTexture = TEX_NUM_INDICES;
-			for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
-				 iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
+			for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
+				 iter != LLAvatarAppearance::getDictionary()->getTextures().end();
 				 iter++)
 			{
 				const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
@@ -979,7 +979,7 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const
 
 		return type;
 	}
-	return LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(te);
+	return LLAvatarAppearance::getDictionary()->getTEWearableType(te);
 }
 
 LLTexLayerInterface::ERenderPass LLTexLayerInterface::getRenderPass() const
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index d12d166dca..28a36e6e41 100644
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -183,7 +183,7 @@ void LLWearable::createVisualParams(LLAvatarAppearance *avatarp)
 void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp)
 {
 	LLTexLayerSet *layer_set = NULL;
-	const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te);
+	const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)te);
 	if (texture_dict && texture_dict->mIsUsedByBakedTexture)
 	{
 		const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
@@ -606,7 +606,7 @@ void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
 	// Deep copy of src (copies only those tes that are current, filling in defaults where needed)
 	for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
 	{
-		if (LLAvatarAppearanceDictionary::getInstance()->getTEWearableType((ETextureIndex) te) == mType)
+		if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
 		{
 			te_map_t::const_iterator iter = src.find(te);
 			LLUUID image_id;
diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp
index bead125e2d..66cc4f3766 100644
--- a/indra/llappearance/llwearabledata.cpp
+++ b/indra/llappearance/llwearabledata.cpp
@@ -339,7 +339,7 @@ U32 LLWearableData::getWearableCount(const LLWearableType::EType type) const
 
 U32 LLWearableData::getWearableCount(const U32 tex_index) const
 {
-	const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
+	const LLWearableType::EType wearable_type = LLAvatarAppearance::getDictionary()->getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
 	return getWearableCount(wearable_type);
 }
 
@@ -349,7 +349,7 @@ LLUUID LLWearableData::computeBakedTextureHash(LLAvatarAppearanceDefines::EBaked
 	LLUUID hash_id;
 	bool hash_computed = false;
 	LLMD5 hash;
-	const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index);
+	const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearance::getDictionary()->getBakedTexture(baked_index);
 
 	for (U8 i=0; i < baked_dict->mWearables.size(); i++)
 	{
-- 
cgit v1.2.3


From 0bd916d9ede3bb3e85ed5a9278498c5e1bb462f5 Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Mon, 30 Nov 2020 15:57:44 +0200
Subject: SL-14369 FIXED BugSplat Crash LLAppViewer::cleanup()

---
 indra/llappearance/llavatarappearance.cpp | 7 +++----
 indra/llappearance/llavatarappearance.h   | 1 -
 2 files changed, 3 insertions(+), 5 deletions(-)

(limited to 'indra/llappearance')

diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index 4d36759167..4894f1fe4e 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -171,7 +171,6 @@ LLAvatarAppearance::LLAvatarXmlInfo::~LLAvatarXmlInfo()
 //-----------------------------------------------------------------------------
 // Static Data
 //-----------------------------------------------------------------------------
-LLXmlTree LLAvatarAppearance::sXMLTree;
 LLXmlTree LLAvatarAppearance::sSkeletonXMLTree;
 LLAvatarSkeletonInfo* LLAvatarAppearance::sAvatarSkeletonInfo = NULL;
 LLAvatarAppearance::LLAvatarXmlInfo* LLAvatarAppearance::sAvatarXmlInfo = NULL;
@@ -353,14 +352,15 @@ void LLAvatarAppearance::initClass(const std::string& avatar_file_name_arg, cons
     {
         avatar_file_name = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR + "_lad.xml");
     }
-	BOOL success = sXMLTree.parseFile( avatar_file_name, FALSE );
+	LLXmlTree xml_tree;
+	BOOL success = xml_tree.parseFile( avatar_file_name, FALSE );
 	if (!success)
 	{
 		LL_ERRS() << "Problem reading avatar configuration file:" << avatar_file_name << LL_ENDL;
 	}
 
 	// now sanity check xml file
-	LLXmlTreeNode* root = sXMLTree.getRoot();
+	LLXmlTreeNode* root = xml_tree.getRoot();
 	if (!root) 
 	{
 		LL_ERRS() << "No root node found in avatar configuration file: " << avatar_file_name << LL_ENDL;
@@ -463,7 +463,6 @@ void LLAvatarAppearance::cleanupClass()
     delete_and_clear(sAvatarDictionary);
     delete_and_clear(sAvatarSkeletonInfo);
 	sSkeletonXMLTree.cleanup();
-	sXMLTree.cleanup();
 }
 
 using namespace LLAvatarAppearanceDefines;
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index d16aeccf0d..4f497c0887 100644
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -211,7 +211,6 @@ public:
 	// XML parse tree
 	//--------------------------------------------------------------------
 protected:
-	static LLXmlTree 	sXMLTree; // avatar config file
 	static LLXmlTree 	sSkeletonXMLTree; // avatar skeleton file
 
 	static LLAvatarSkeletonInfo* 					sAvatarSkeletonInfo;
-- 
cgit v1.2.3


From 792c086e91c4f66d2cde6a9db7fcc17f9918c3c0 Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Mon, 30 Nov 2020 20:19:54 +0200
Subject: SL-14369 Get rid of static sSkeletonXMLTree

---
 indra/llappearance/llavatarappearance.cpp | 13 ++++++-------
 indra/llappearance/llavatarappearance.h   |  4 +---
 2 files changed, 7 insertions(+), 10 deletions(-)

(limited to 'indra/llappearance')

diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index 4894f1fe4e..90dfa04f28 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -171,7 +171,6 @@ LLAvatarAppearance::LLAvatarXmlInfo::~LLAvatarXmlInfo()
 //-----------------------------------------------------------------------------
 // Static Data
 //-----------------------------------------------------------------------------
-LLXmlTree LLAvatarAppearance::sSkeletonXMLTree;
 LLAvatarSkeletonInfo* LLAvatarAppearance::sAvatarSkeletonInfo = NULL;
 LLAvatarAppearance::LLAvatarXmlInfo* LLAvatarAppearance::sAvatarXmlInfo = NULL;
 LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* LLAvatarAppearance::sAvatarDictionary = NULL;
@@ -407,8 +406,9 @@ void LLAvatarAppearance::initClass(const std::string& avatar_file_name_arg, cons
     }
 	
 	std::string skeleton_path;
+	LLXmlTree skeleton_xml_tree;
 	skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name);
-	if (!parseSkeletonFile(skeleton_path))
+	if (!parseSkeletonFile(skeleton_path, skeleton_xml_tree))
 	{
 		LL_ERRS() << "Error parsing skeleton file: " << skeleton_path << LL_ENDL;
 	}
@@ -421,7 +421,7 @@ void LLAvatarAppearance::initClass(const std::string& avatar_file_name_arg, cons
 		delete sAvatarSkeletonInfo;
 	}
 	sAvatarSkeletonInfo = new LLAvatarSkeletonInfo;
-	if (!sAvatarSkeletonInfo->parseXml(sSkeletonXMLTree.getRoot()))
+	if (!sAvatarSkeletonInfo->parseXml(skeleton_xml_tree.getRoot()))
 	{
 		LL_ERRS() << "Error parsing skeleton XML file: " << skeleton_path << LL_ENDL;
 	}
@@ -462,7 +462,6 @@ void LLAvatarAppearance::cleanupClass()
 	delete_and_clear(sAvatarXmlInfo);
     delete_and_clear(sAvatarDictionary);
     delete_and_clear(sAvatarSkeletonInfo);
-	sSkeletonXMLTree.cleanup();
 }
 
 using namespace LLAvatarAppearanceDefines;
@@ -584,12 +583,12 @@ void LLAvatarAppearance::computeBodySize()
 //-----------------------------------------------------------------------------
 // parseSkeletonFile()
 //-----------------------------------------------------------------------------
-BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename)
+BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename, LLXmlTree& skeleton_xml_tree)
 {
 	//-------------------------------------------------------------------------
 	// parse the file
 	//-------------------------------------------------------------------------
-	BOOL parsesuccess = sSkeletonXMLTree.parseFile( filename, FALSE );
+	BOOL parsesuccess = skeleton_xml_tree.parseFile( filename, FALSE );
 
 	if (!parsesuccess)
 	{
@@ -598,7 +597,7 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename)
 	}
 
 	// now sanity check xml file
-	LLXmlTreeNode* root = sSkeletonXMLTree.getRoot();
+	LLXmlTreeNode* root = skeleton_xml_tree.getRoot();
 	if (!root) 
 	{
 		LL_ERRS() << "No root node found in avatar skeleton file: " << filename << LL_ENDL;
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index 4f497c0887..b1c70f9064 100644
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -156,7 +156,7 @@ public:
 
 
 protected:
-	static BOOL			parseSkeletonFile(const std::string& filename);
+	static BOOL			parseSkeletonFile(const std::string& filename, LLXmlTree& skeleton_xml_tree);
 	virtual void		buildCharacter();
 	virtual BOOL		loadAvatar();
 
@@ -211,8 +211,6 @@ public:
 	// XML parse tree
 	//--------------------------------------------------------------------
 protected:
-	static LLXmlTree 	sSkeletonXMLTree; // avatar skeleton file
-
 	static LLAvatarSkeletonInfo* 					sAvatarSkeletonInfo;
 	static LLAvatarXmlInfo* 						sAvatarXmlInfo;
 
-- 
cgit v1.2.3