Fix crash when SinguReplaceLinks is false reported by Beware

This commit is contained in:
Lirusaito
2019-05-07 00:33:39 -04:00
parent 9bcd3298ba
commit 2075d92369
3 changed files with 22 additions and 13 deletions

View File

@@ -4317,7 +4317,7 @@ void LLTextEditor::appendTextImpl(const std::string &new_text, const LLStyleSP s
if (always_underline) link_style->mUnderline = true;
appendAndHighlightText(link, part, link_style, !always_underline/*match.underlineOnHoverOnly()*/);
};
const auto&& cb = force_replace_links ? boost::bind(&LLTextEditor::replaceUrl, this, _1, _2, _3) : LLUrlLabelCallback::slot_function_type();
const auto&& cb = force_replace_links ? boost::bind(&LLTextEditor::replaceUrl, this, _1, _2, _3) : LLUrlLabelCallback();
while (!text.empty() && LLUrlRegistry::instance().findUrl(text, match, cb))
{
start = match.getStart();

View File

@@ -673,9 +673,12 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
}
else
{
auto connection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2));
mAvatarNameCacheConnections.emplace(agent_id, connection);
addObserver(agent_id_string, url, cb);
if (cb)
{
auto connection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2));
mAvatarNameCacheConnections.emplace(agent_id, connection);
addObserver(agent_id_string, url, cb);
}
return LLTrans::getString("LoadingData");
}
}
@@ -785,9 +788,12 @@ std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLab
}
else
{
auto connection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2));
mAvatarNameCacheConnections.emplace(agent_id, connection);
addObserver(agent_id_string, url, cb);
if (cb)
{
auto connection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2));
mAvatarNameCacheConnections.emplace(agent_id, connection);
addObserver(agent_id_string, url, cb);
}
return LLTrans::getString("LoadingData");
}
}
@@ -921,10 +927,13 @@ std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCa
}
else
{
gCacheName->getGroup(group_id,
boost::bind(&LLUrlEntryGroup::onGroupNameReceived,
this, _1, _2, _3));
addObserver(group_id_string, url, cb);
if (cb)
{
gCacheName->getGroup(group_id,
boost::bind(&LLUrlEntryGroup::onGroupNameReceived,
this, _1, _2, _3));
addObserver(group_id_string, url, cb);
}
return LLTrans::getString("LoadingData");
}
}
@@ -1028,7 +1037,7 @@ std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelC
std::string parcel_id_string = unescapeUrl(path_array[2]); // parcel id
// Add an observer to call LLUrlLabelCallback when we have parcel name.
addObserver(parcel_id_string, url, cb);
if (cb) addObserver(parcel_id_string, url, cb);
LLUUID parcel_id(parcel_id_string);

View File

@@ -42,7 +42,7 @@ class LLAvatarName;
typedef boost::signals2::signal<void (const std::string& url,
const std::string& label,
const std::string& icon)> LLUrlLabelSignal;
typedef LLUrlLabelSignal::slot_type LLUrlLabelCallback;
typedef LLUrlLabelSignal::slot_function_type LLUrlLabelCallback;
///
/// LLUrlEntryBase is the base class of all Url types registered in the