From 924640663f3f9ecccbcc86e8e3943b9f6a5ccd97 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 28 Jul 2016 17:41:30 +0200 Subject: [PATCH] FIRE-19737: Agent's calling card get duplicated after clearing inventory cache --- indra/newview/llfriendcard.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 201298c2d4..6874c64f92 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -640,7 +640,7 @@ void LLFriendCardsManager::onFriendListUpdate(U32 changed_mask) void create_agent_calling_card_name_cb(const LLAvatarName& av_name, const LLUUID& calling_cards_folder_id) { create_inventory_item(gAgentID, - gAgent.getSessionID(), + gAgentSessionID, calling_cards_folder_id, LLTransactionID::tnull, av_name.getUserName(), @@ -652,11 +652,8 @@ void create_agent_calling_card_name_cb(const LLAvatarName& av_name, const LLUUID NULL); } -// static -void LLFriendCardsManager::createAgentCallingCard() +void calling_card_folder_loaded_cb(const LLUUID& calling_cards_folder_id) { - const LLUUID calling_cards_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); - LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; LLFindAgentCallingCard collector; @@ -668,5 +665,26 @@ void LLFriendCardsManager::createAgentCallingCard() LLAvatarNameCache::get(gAgentID, boost::bind(&create_agent_calling_card_name_cb, _2, calling_cards_folder_id)); } } + +// static +void LLFriendCardsManager::createAgentCallingCard() +{ + const LLUUID calling_cards_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); + + // This instance will be deleted in LLInitialFriendCardsFetch::done(). + LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(calling_cards_folder_id, boost::bind(&calling_card_folder_loaded_cb, calling_cards_folder_id)); + fetch->startFetch(); + if (fetch->isFinished()) + { + // everything is already here - call done. + fetch->done(); + } + else + { + // it's all on it's way - add an observer, and the inventory + // will call done for us when everything is here. + gInventory.addObserver(fetch); + } +} // // EOF