From 6afd635da4b49a81223b51f0b3ecf174416e697e Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Thu, 15 Sep 2022 23:12:06 +0300
Subject: [PATCH] SL-18125 Material asset creation pulls wrong set of
 permissions

---
 indra/newview/llmaterialeditor.cpp | 2 +-
 indra/newview/llsettingsvo.cpp     | 2 +-
 indra/newview/lltexturectrl.cpp    | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 477f834a225..b4e5e14885a 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -761,7 +761,7 @@ bool LLMaterialEditor::saveIfNeeded()
         tid.generate();     // timestamp-based randomization + uniquification
         LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
         std::string res_desc = buildMaterialDescription();
-        U32 next_owner_perm = LLPermissions::DEFAULT.getMaskNextOwner();
+        U32 next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Uploads");
         LLUUID parent = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_MATERIAL);
         const U8 subtype = NO_INV_SUBTYPE;  // TODO maybe use AT_SETTINGS and LLSettingsType::ST_MATERIAL ?
 
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index a1c703b02fd..634fc394602 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -123,7 +123,7 @@ void LLSettingsVOBase::createNewInventoryItem(LLSettingsType::type_e stype, cons
 
 void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, std::string settings_name, inventory_result_fn callback)
 {
-    U32 nextOwnerPerm = LLPermissions::DEFAULT.getMaskNextOwner();
+    U32 nextOwnerPerm = LLFloaterPerms::getNextOwnerPerms("Settings");
     createInventoryItem(settings, nextOwnerPerm, parent_id, settings_name, callback);
 }
 
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index c167fcc7172..f4649a672b6 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -508,6 +508,8 @@ void LLFloaterTexturePicker::draw()
 
 			if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID))
 			{
+                // TODO: Fix this! Picker is not warrantied to be connected to a selection
+                // LLSelectMgr shouldn't be used in texture picker
 				LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
 				if (obj)
 				{
-- 
GitLab