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