summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2023-07-13 14:13:24 -0700
committerRoxie Linden <roxie@lindenlab.com>2023-07-13 14:13:24 -0700
commit9a3c76757f7f635c0b8e47277881fea195d6b672 (patch)
tree2369971f9466b09cac0838bc80ea68720feaad89 /indra
parent0bc7cee2e18ae81526cda08298dce2e553e30ee9 (diff)
SL-20009 - race condition - calling cards could be created without name
This happens when a calling card is created before the name is in the name cache.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfriendcard.cpp15
-rw-r--r--indra/newview/llviewerinventory.cpp25
2 files changed, 21 insertions, 19 deletions
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index e395da7f1e..97fff033b6 100644
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -534,20 +534,7 @@ void LLFriendCardsManager::syncFriendsFolder()
// Create own calling card if it was not found in Friends/All folder
if (!collector.isAgentCallingCardFound())
{
- LLAvatarName av_name;
- LLAvatarNameCache::get( gAgentID, &av_name );
-
- create_inventory_item(gAgentID,
- gAgent.getSessionID(),
- calling_cards_folder_id,
- LLTransactionID::tnull,
- av_name.getCompleteName(),
- gAgentID.asString(),
- LLAssetType::AT_CALLINGCARD,
- LLInventoryType::IT_CALLINGCARD,
- NO_INV_SUBTYPE,
- PERM_MOVE | PERM_TRANSFER,
- NULL);
+ create_inventory_callingcard(gAgentID, calling_cards_folder_id);
}
// All folders created and updated.
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 50252556de..c13acb4158 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1046,14 +1046,29 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
gAgent.sendReliableMessage();
}
+void create_inventory_callingcard_callback(LLPointer<LLInventoryCallback> cb,
+ const LLUUID &parent,
+ const LLUUID &avatar_id,
+ const LLAvatarName &av_name)
+{
+ std::string item_desc = avatar_id.asString();
+ create_inventory_item(gAgent.getID(),
+ gAgent.getSessionID(),
+ parent,
+ LLTransactionID::tnull,
+ av_name.getUserName(),
+ item_desc,
+ LLAssetType::AT_CALLINGCARD,
+ LLInventoryType::IT_CALLINGCARD,
+ NO_INV_SUBTYPE,
+ PERM_MOVE | PERM_TRANSFER,
+ cb);
+}
+
void create_inventory_callingcard(const LLUUID& avatar_id, const LLUUID& parent /*= LLUUID::null*/, LLPointer<LLInventoryCallback> cb/*=NULL*/)
{
- std::string item_desc = avatar_id.asString();
LLAvatarName av_name;
- LLAvatarNameCache::get(avatar_id, &av_name);
- create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
- parent, LLTransactionID::tnull, av_name.getUserName(), item_desc, LLAssetType::AT_CALLINGCARD,
- LLInventoryType::IT_CALLINGCARD, NO_INV_SUBTYPE, PERM_MOVE | PERM_TRANSFER, cb);
+ LLAvatarNameCache::get(avatar_id, boost::bind(&create_inventory_callingcard_callback, cb, parent, _1, _2));
}
void create_inventory_wearable(const LLUUID& agent_id, const LLUUID& session_id,