From d9a8ccc2c061bc034ebb6fb13b0950615d8bf30d Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Fri, 16 Jun 2023 12:22:56 +0300
Subject: [PATCH] SL-19882 Fix LLInventoryGalleryItem redeclaring mName

To avoid confusion and potential inheritance issues
---
 indra/newview/llinventorygallery.cpp | 16 ++++++++--------
 indra/newview/llinventorygallery.h   |  6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index 53b62c7fb71..c584def3eb6 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -565,8 +565,8 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L
     giparams.visible = true;
     giparams.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP);
     giparams.rect(LLRect(0,mItemHeight, mItemWidth, 0));
-    giparams.name = name;
     LLInventoryGalleryItem* gitem = LLUICtrlFactory::create<LLInventoryGalleryItem>(giparams);
+    gitem->setItemName(name);
     gitem->setUUID(item_id);
     gitem->setGallery(this);
     gitem->setType(type, inventory_type, flags, is_link);
@@ -889,7 +889,7 @@ void LLInventoryGallery::updateChangedItemName(LLUUID item_id, std::string name)
         LLInventoryGalleryItem* item = iter->second;
         if (item)
         {
-            item->setName(name);
+            item->setItemName(name);
         }
     }
 }
@@ -2001,7 +2001,7 @@ LLInventoryGalleryItem::LLInventoryGalleryItem(const Params& p)
     : LLPanel(p),
     mSelected(false),
     mDefaultImage(true),
-    mName(""),
+    mItemName(""),
     mWornSuffix(""),
     mPermSuffix(""),
     mUUID(LLUUID()),
@@ -2117,9 +2117,9 @@ void LLInventoryGalleryItem::draw()
     gl_rect_2d(border, border_color.get(), FALSE);
 }
 
-void LLInventoryGalleryItem::setName(std::string name)
+void LLInventoryGalleryItem::setItemName(std::string name)
 {
-    mName = name;
+    mItemName = name;
     updateNameText();
 }
 
@@ -2287,9 +2287,9 @@ LLFontGL* LLInventoryGalleryItem::getTextFont()
 void LLInventoryGalleryItem::updateNameText()
 {
     mNameText->setFont(getTextFont());
-    mNameText->setText(mName + mPermSuffix + mWornSuffix);
-    mNameText->setToolTip(mName + mPermSuffix + mWornSuffix);
-    getChild<LLThumbnailCtrl>("preview_thumbnail")->setToolTip(mName + mPermSuffix + mWornSuffix);
+    mNameText->setText(mItemName + mPermSuffix + mWornSuffix);
+    mNameText->setToolTip(mItemName + mPermSuffix + mWornSuffix);
+    getChild<LLThumbnailCtrl>("preview_thumbnail")->setToolTip(mItemName + mPermSuffix + mWornSuffix);
 }
 
 //-----------------------------
diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h
index ce618602dfe..cb95f61255d 100644
--- a/indra/newview/llinventorygallery.h
+++ b/indra/newview/llinventorygallery.h
@@ -288,7 +288,7 @@ class LLInventoryGalleryItem : public LLPanel
 
     LLFontGL* getTextFont();
 
-    void setName(std::string name);
+    void setItemName(std::string name);
     void setSelected(bool value);
     void setWorn(bool value);
     void setUUID(LLUUID id) {mUUID = id;}
@@ -301,7 +301,7 @@ class LLInventoryGalleryItem : public LLPanel
     void setCreatorName(std::string name) {mCreatorName = name;}
     std::string getCreatorName() { return mCreatorName;}
 
-    std::string getItemName() {return mName;}
+    std::string getItemName() {return mItemName;}
     std::string getItemNameSuffix() {return mPermSuffix + mWornSuffix;}
     bool isDefaultImage() {return mDefaultImage;}
     
@@ -335,7 +335,7 @@ class LLInventoryGalleryItem : public LLPanel
 
     EInventorySortGroup mSortGroup;
     LLAssetType::EType mType;
-    std::string mName;
+    std::string mItemName;
     std::string mWornSuffix;
     std::string mPermSuffix;
     LLInventoryGallery* mGallery;
-- 
GitLab