Skip to content

Commit 75a01bf

Browse files
committed
#3319 Crash at LLInitParam::Param::setProvided
Most crashes are related to LLStyle, log analysis suggests that it might be a number of different issues, including memory and disk issues. Just avoid recreating expensive LLStyle without reason.
1 parent 306e9e6 commit 75a01bf

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

indra/llui/llstyle.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ LLStyle::Params::Params()
3939
readonly_color("readonly_color", LLColor4::black),
4040
selected_color("selected_color", LLColor4::black),
4141
alpha("alpha", 1.f),
42-
font("font", LLFontGL::getFontMonospace()),
42+
font("font", LLStyle::getDefaultFont()),
4343
image("image"),
4444
link_href("href"),
4545
is_link("is_link")
@@ -70,6 +70,11 @@ const LLFontGL* LLStyle::getFont() const
7070
return mFont;
7171
}
7272

73+
const LLFontGL* LLStyle::getDefaultFont()
74+
{
75+
return LLFontGL::getFontMonospace();
76+
}
77+
7378
void LLStyle::setLinkHREF(const std::string& href)
7479
{
7580
mLink = href;

indra/llui/llstyle.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class LLStyle : public LLRefCount
7272

7373
void setFont(const LLFontGL* font);
7474
const LLFontGL* getFont() const;
75+
static const LLFontGL* getDefaultFont();
7576

7677
const std::string& getLinkHREF() const { return mLink; }
7778
void setLinkHREF(const std::string& href);

indra/llui/lltextbase.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,8 @@ void LLTextBase::onVisibilityChange( bool new_visibility )
14381438
//virtual
14391439
void LLTextBase::setValue(const LLSD& value )
14401440
{
1441-
setText(value.asString());
1441+
static const LLStyle::Params input_params = LLStyle::Params();
1442+
setText(value.asString(), input_params);
14421443
}
14431444

14441445
//virtual
@@ -3880,8 +3881,7 @@ bool LLInlineViewSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& w
38803881
if (mForceNewLine)
38813882
{
38823883
// Chat, string can't be smaller then font height even if it is empty
3883-
LLStyleSP s(new LLStyle(LLStyle::Params().visible(true)));
3884-
height = s->getFont()->getLineHeight();
3884+
height = LLStyle::getDefaultFont()->getLineHeight();
38853885

38863886
return true; // new line
38873887
}
@@ -3945,9 +3945,7 @@ void LLInlineViewSegment::linkToDocument(LLTextBase* editor)
39453945

39463946
LLLineBreakTextSegment::LLLineBreakTextSegment(S32 pos):LLTextSegment(pos,pos+1)
39473947
{
3948-
LLStyleSP s( new LLStyle(LLStyle::Params().visible(true)));
3949-
3950-
mFontHeight = s->getFont()->getLineHeight();
3948+
mFontHeight = LLStyle::getDefaultFont()->getLineHeight();
39513949
}
39523950
LLLineBreakTextSegment::LLLineBreakTextSegment(LLStyleConstSP style,S32 pos):LLTextSegment(pos,pos+1)
39533951
{

indra/llui/lltextbox.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ LLSD LLTextBox::getValue() const
159159
bool LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text )
160160
{
161161
mText.setArg(key, text);
162-
LLTextBase::setText(mText.getString());
162+
static const LLStyle::Params input_params = LLStyle::Params();
163+
LLTextBase::setText(mText.getString(), input_params);
163164

164165
return true;
165166
}

indra/newview/llfloaterimsessiontab.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,8 @@ void LLFloaterIMSessionTab::appendMessage(const LLChat& chat, const LLSD& args)
633633
chat_args["show_names_for_p2p_conv"] = !mIsP2PChat ||
634634
gSavedSettings.getBOOL("IMShowNamesForP2PConv");
635635

636-
mChatHistory->appendMessage(chat, chat_args);
636+
static const LLStyle::Params input_append_params = LLStyle::Params();
637+
mChatHistory->appendMessage(chat, chat_args, input_append_params);
637638
}
638639

639640
void LLFloaterIMSessionTab::updateUsedEmojis(LLWStringView text)

0 commit comments

Comments
 (0)