From f297068ec053d3f8f3ee1eeea8bf7711af3fb151 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Tue, 2 Aug 2011 23:26:02 +0200 Subject: [PATCH] Don't instantiate LLTextParser::getInstance before user logged in. --- indra/llui/lltextparser.cpp | 11 +++++------ indra/newview/llconsole.cpp | 10 +++++++++- indra/newview/llfloaterchat.cpp | 4 ++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp index 2493afcb5..c8a85dd86 100644 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -233,15 +233,14 @@ void LLTextParser::loadKeywords() bool LLTextParser::saveToDisk(LLSD highlights) { mHighlights=highlights; - std::string filename=getFileName(); - if (filename.empty()) + if (gDirUtilp->getLindenUserDir(true).empty()) { - llwarns << "LLTextParser::saveToDisk() no valid user directory." << llendl; - return FALSE; + // User didn't login, so nothing to save. + return false; } llofstream file; - file.open(filename.c_str()); + file.open(getFileName().c_str()); LLSDSerialize::toPrettyXML(mHighlights, file); file.close(); - return TRUE; + return true; } diff --git a/indra/newview/llconsole.cpp b/indra/newview/llconsole.cpp index 937ccec24..db2d474b0 100644 --- a/indra/newview/llconsole.cpp +++ b/indra/newview/llconsole.cpp @@ -456,6 +456,14 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_time) : mParagraphText(str), mAddTime(add_time), mMaxWidth(-1) { - makeParagraphColorSegments(color); + // Only call makeParagraphColorSegments if the user logged in already (we come + // here before he logged in when they disabled login/logout screens). + // Otherwise makeParagraphColorSegments calls LLTextParser::getInstance() which + // causes a one-time initialization by reading highlights.xml, which fails + // when not logged in because it's per account. + if (!gDirUtilp->getLindenUserDir(true).empty()) + { + makeParagraphColorSegments(color); + } } diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 133986dfa..eac5187f0 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -497,6 +497,10 @@ void LLFloaterChat::addChat(const LLChat& chat, //static void LLFloaterChat::triggerAlerts(const std::string& text) { + // Cannot instantiate LLTextParser before logging in. + if (gDirUtilp->getLindenUserDir(true).empty()) + return; + LLTextParser* parser = LLTextParser::getInstance(); // bool spoken=FALSE; for (S32 i=0;imHighlights.size();i++)