Fix rare shutdown crash in gCacheName
parent
7d2cd036ea
commit
3013424057
|
|
@ -53,7 +53,6 @@ const U32 PENDING_TIMEOUT_SECS = 5 * 60;
|
|||
|
||||
// Globals
|
||||
LLCacheName* gCacheName = NULL;
|
||||
std::map<std::string, std::string> LLCacheName::sCacheName;
|
||||
|
||||
/// ---------------------------------------------------------------------------
|
||||
/// class LLCacheNameEntry
|
||||
|
|
@ -215,7 +214,7 @@ public:
|
|||
Impl(LLMessageSystem* msg);
|
||||
~Impl();
|
||||
|
||||
bool getName(const LLUUID& id, std::string& first, std::string& last);
|
||||
bool getName(const LLUUID& id, std::string& first, std::string& last, std::map<std::string, std::string>& default_names);
|
||||
|
||||
boost::signals2::connection addPending(const LLUUID& id, const LLCacheNameCallback& callback);
|
||||
void addPending(const LLUUID& id, const LLHost& host);
|
||||
|
|
@ -247,9 +246,9 @@ LLCacheName::LLCacheName(LLMessageSystem* msg)
|
|||
LLCacheName::LLCacheName(LLMessageSystem* msg, const LLHost& upstream_host)
|
||||
: impl(* new Impl(msg))
|
||||
{
|
||||
sCacheName["waiting"] = "(Loading...)";
|
||||
sCacheName["nobody"] = "(nobody)";
|
||||
sCacheName["none"] = "(none)";
|
||||
mCacheName["waiting"] = "(Loading...)";
|
||||
mCacheName["nobody"] = "(nobody)";
|
||||
mCacheName["none"] = "(none)";
|
||||
setUpstream(upstream_host);
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +273,7 @@ LLCacheName::Impl::Impl(LLMessageSystem* msg)
|
|||
|
||||
LLCacheName::Impl::~Impl()
|
||||
{
|
||||
for_each(mCache.begin(), mCache.end(), DeletePairedPointer());
|
||||
std::for_each(mCache.begin(), mCache.end(), DeletePairedPointer());
|
||||
mCache.clear();
|
||||
for_each(mReplyQueue.begin(), mReplyQueue.end(), DeletePointer());
|
||||
mReplyQueue.clear();
|
||||
|
|
@ -402,11 +401,11 @@ void LLCacheName::exportFile(std::ostream& ostr)
|
|||
}
|
||||
|
||||
|
||||
bool LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::string& last)
|
||||
bool LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::string& last, std::map<std::string, std::string>& default_names)
|
||||
{
|
||||
if(id.isNull())
|
||||
{
|
||||
first = sCacheName["nobody"];
|
||||
first = default_names["nobody"];
|
||||
last.clear();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -420,7 +419,7 @@ bool LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::strin
|
|||
}
|
||||
else
|
||||
{
|
||||
first = sCacheName["waiting"];
|
||||
first = default_names["waiting"];
|
||||
last.clear();
|
||||
if (!isRequestPending(id))
|
||||
{
|
||||
|
|
@ -434,8 +433,8 @@ bool LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::strin
|
|||
// static
|
||||
void LLCacheName::localizeCacheName(std::string key, std::string value)
|
||||
{
|
||||
if (key!="" && value!= "" )
|
||||
sCacheName[key]=value;
|
||||
if (!key.empty() && !value.empty())
|
||||
mCacheName[key]=value;
|
||||
else
|
||||
LL_WARNS()<< " Error localizing cache key " << key << " To "<< value<<LL_ENDL;
|
||||
}
|
||||
|
|
@ -443,7 +442,7 @@ void LLCacheName::localizeCacheName(std::string key, std::string value)
|
|||
bool LLCacheName::getFullName(const LLUUID& id, std::string& fullname)
|
||||
{
|
||||
std::string first_name, last_name;
|
||||
bool res = impl.getName(id, first_name, last_name);
|
||||
bool res = impl.getName(id, first_name, last_name, mCacheName);
|
||||
fullname = buildFullName(first_name, last_name);
|
||||
return res;
|
||||
}
|
||||
|
|
@ -454,7 +453,7 @@ bool LLCacheName::getGroupName(const LLUUID& id, std::string& group)
|
|||
{
|
||||
if(id.isNull())
|
||||
{
|
||||
group = sCacheName["none"];
|
||||
group = mCacheName["none"];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -475,7 +474,7 @@ bool LLCacheName::getGroupName(const LLUUID& id, std::string& group)
|
|||
}
|
||||
else
|
||||
{
|
||||
group = sCacheName["waiting"];
|
||||
group = mCacheName["waiting"];
|
||||
if (!impl.isRequestPending(id))
|
||||
{
|
||||
impl.mAskGroupQueue.insert(id);
|
||||
|
|
@ -614,7 +613,7 @@ boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, co
|
|||
{
|
||||
LLCacheNameSignal signal;
|
||||
signal.connect(callback);
|
||||
signal(id, sCacheName["nobody"], is_group);
|
||||
signal(id, mCacheName["nobody"], is_group);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -754,14 +753,14 @@ void LLCacheName::dumpStats()
|
|||
|
||||
void LLCacheName::clear()
|
||||
{
|
||||
for_each(impl.mCache.begin(), impl.mCache.end(), DeletePairedPointer());
|
||||
std::for_each(impl.mCache.begin(), impl.mCache.end(), DeletePairedPointer());
|
||||
impl.mCache.clear();
|
||||
}
|
||||
|
||||
//static
|
||||
std::string LLCacheName::getDefaultName()
|
||||
{
|
||||
return sCacheName["waiting"];
|
||||
return mCacheName["waiting"];
|
||||
}
|
||||
|
||||
//static
|
||||
|
|
|
|||
|
|
@ -127,15 +127,16 @@ public:
|
|||
void dumpStats(); // Dumps the sizes of the cache and associated queues.
|
||||
void clear(); // Deletes all entries from the cache
|
||||
|
||||
static std::string getDefaultName();
|
||||
std::string getDefaultName();
|
||||
|
||||
// Returns "Resident", the default last name for SLID-based accounts
|
||||
// that have no last name.
|
||||
static std::string getDefaultLastName();
|
||||
|
||||
static void localizeCacheName(std::string key, std::string value);
|
||||
static std::map<std::string, std::string> sCacheName;
|
||||
void localizeCacheName(std::string key, std::string value);
|
||||
|
||||
private:
|
||||
std::map<std::string, std::string> mCacheName;
|
||||
|
||||
class Impl;
|
||||
Impl& impl;
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ void LLFloaterAvatarPicker::populateNearMe()
|
|||
if (!LLAvatarNameCache::get(av, &av_name))
|
||||
{
|
||||
element["columns"][0]["column"] = "name";
|
||||
element["columns"][0]["value"] = LLCacheName::getDefaultName();
|
||||
element["columns"][0]["value"] = gCacheName->getDefaultName();
|
||||
all_loaded = false;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -6293,7 +6293,7 @@ void LLCallingCardBridge::performAction(LLInventoryModel* model, std::string act
|
|||
if (item && (item->getCreatorUUID() != gAgent.getID()) &&
|
||||
(!item->getCreatorUUID().isNull()))
|
||||
{
|
||||
std::string callingcard_name = LLCacheName::getDefaultName();
|
||||
std::string callingcard_name = gCacheName->getDefaultName();
|
||||
LLAvatarName av_name;
|
||||
if (LLAvatarNameCache::get(item->getCreatorUUID(), &av_name))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue