summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2019-04-25 15:40:44 -0400
committerNat Goodspeed <nat@lindenlab.com>2019-04-25 15:40:44 -0400
commita2d4122de41ff161b7397ca663a41595cb9dbf2a (patch)
tree3464c49f2659fc4e9e101ef11f271e942f113bd3 /indra
parent468fbd6b515cf321834e0056adde9b29e07ccffc (diff)
Reorder logic in LLAppViewer::initConfiguration(); remove dup code.
There were two nearly-identical copies of a stanza that calls sendURLToOtherInstance(). Remove one. It's possible that the reason no one noticed the duplication was because the two copies were 70 lines apart. Move setSkinFolder(), setUseSpellCheck() and setSecondaryDictionaries() stanzas to consolidate SLURL-handling code more closely. Also move logic for NextLoginLocation and CmdLineLoginLocation. Remove a couple unnecessary std::ostringstream instances. Streaming a single string literal to std::ostringstream and retrieving its str() is the same as simply converting the literal to std::string, only slower. OSMessageBox() accepts const std::string&. Given that you have a std::string in hand, passing its c_str() to OSMessageBox() is not only unnecessary but wasteful: it requires silently converting the const char* back to a different std::string instance. Calling a class method from another method of the same class does not require ClassName:: qualification. Calling a singleton subclass method from another non-static method of the same subclass does not require going through ClassName::instance() or sInstance or whatever.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llappviewer.cpp124
1 files changed, 56 insertions, 68 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 1bc21ec469..9d658ab376 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2429,9 +2429,9 @@ bool LLAppViewer::initConfiguration()
bool set_defaults = true;
if(!loadSettingsFromDirectory("Default", set_defaults))
{
- std::ostringstream msg;
- msg << "Unable to load default settings file. The installation may be corrupted.";
- OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK);
+ OSMessageBox(
+ "Unable to load default settings file. The installation may be corrupted.",
+ LLStringUtil::null,OSMB_OK);
return false;
}
@@ -2552,7 +2552,7 @@ bool LLAppViewer::initConfiguration()
if(gSavedSettings.getBOOL("DisableCrashLogger"))
{
LL_WARNS() << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << LL_ENDL;
- LLAppViewer::instance()->disableCrashlogger();
+ disableCrashlogger();
}
// Handle initialization from settings.
@@ -2569,7 +2569,7 @@ bool LLAppViewer::initConfiguration()
LL_INFOS() << msg.str() << LL_ENDL;
OSMessageBox(
- msg.str().c_str(),
+ msg.str(),
LLStringUtil::null,
OSMB_OK);
@@ -2679,7 +2679,34 @@ bool LLAppViewer::initConfiguration()
ll_init_fail_log(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "test_failures.log"));
}
+ const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
+ if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString())
+ {
+ // Examining "Language" may not suffice -- see LLUI::getLanguage()
+ // logic. Unfortunately LLUI::getLanguage() doesn't yet do us much
+ // good because we haven't yet called LLUI::initClass().
+ gDirUtilp->setSkinFolder(skinfolder->getValue().asString(),
+ gSavedSettings.getString("Language"));
+ }
+
+ if (gSavedSettings.getBOOL("SpellCheck"))
+ {
+ std::list<std::string> dict_list;
+ std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary");
+ boost::split(dict_list, dict_setting, boost::is_any_of(std::string(",")));
+ if (!dict_list.empty())
+ {
+ LLSpellChecker::setUseSpellCheck(dict_list.front());
+ dict_list.pop_front();
+ LLSpellChecker::instance().setSecondaryDictionaries(dict_list);
+ }
+ }
+
// Handle slurl use. NOTE: Don't let SL-55321 reappear.
+ // This initial-SLURL logic, up through the call to
+ // sendURLToOtherInstance(), must precede LLSplashScreen::show() --
+ // because if sendURLToOtherInstance() succeeds, we take a fast exit,
+ // SKIPPING the splash screen and everything else.
// *FIX: This init code should be made more robust to prevent
// the issue SL-55321 from returning. One thought is to allow
@@ -2724,6 +2751,27 @@ bool LLAppViewer::initConfiguration()
}
}
+ // NextLoginLocation is set as a side effect of LLStartUp::setStartSLURL()
+ std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
+ if ( !nextLoginLocation.empty() )
+ {
+ LL_DEBUGS("AppInit")<<"set start from NextLoginLocation: "<<nextLoginLocation<<LL_ENDL;
+ LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation));
+ }
+ else if ( ( clp.hasOption("login") || clp.hasOption("autologin"))
+ && gSavedSettings.getString("CmdLineLoginLocation").empty())
+ {
+ // If automatic login from command line with --login switch
+ // init StartSLURL location.
+ std::string start_slurl_setting = gSavedSettings.getString("LoginLocation");
+ LL_DEBUGS("AppInit") << "start slurl setting '" << start_slurl_setting << "'" << LL_ENDL;
+ LLStartUp::setStartSLURL(LLSLURL(start_slurl_setting));
+ }
+ else
+ {
+ // the login location will be set by the login panel (see LLPanelLogin)
+ }
+
//RN: if we received a URL, hand it off to the existing instance.
// don't call anotherInstanceRunning() when doing URL handoff, as
// it relies on checking a marker file which will not work when running
@@ -2739,30 +2787,6 @@ bool LLAppViewer::initConfiguration()
}
}
- const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
- if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString())
- {
- // Examining "Language" may not suffice -- see LLUI::getLanguage()
- // logic. Unfortunately LLUI::getLanguage() doesn't yet do us much
- // good because we haven't yet called LLUI::initClass().
- gDirUtilp->setSkinFolder(skinfolder->getValue().asString(),
- gSavedSettings.getString("Language"));
- }
-
- if (gSavedSettings.getBOOL("SpellCheck"))
- {
- std::list<std::string> dict_list;
- std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary");
- boost::split(dict_list, dict_setting, boost::is_any_of(std::string(",")));
- if (!dict_list.empty())
- {
- LLSpellChecker::setUseSpellCheck(dict_list.front());
- dict_list.pop_front();
- LLSpellChecker::instance().setSecondaryDictionaries(dict_list);
- }
- }
-
-
// Display splash screen. Must be after above check for previous
// crash as this dialog is always frontmost.
std::string splash_msg;
@@ -2794,30 +2818,15 @@ bool LLAppViewer::initConfiguration()
}
LLStringUtil::truncate(gWindowTitle, 255);
- //RN: if we received a URL, hand it off to the existing instance.
- // don't call anotherInstanceRunning() when doing URL handoff, as
- // it relies on checking a marker file which will not work when running
- // out of different directories
-
- if (LLStartUp::getStartSLURL().isValid() &&
- (gSavedSettings.getBOOL("SLURLPassToOtherInstance")))
- {
- if (sendURLToOtherInstance(LLStartUp::getStartSLURL().getSLURLString()))
- {
- // successfully handed off URL to existing instance, exit
- return false;
- }
- }
-
//
// Check for another instance of the app running
+ // This happens AFTER LLSplashScreen::show(). That may or may not be
+ // important.
//
if (mSecondInstance && !gSavedSettings.getBOOL("AllowMultipleViewers"))
{
- std::ostringstream msg;
- msg << LLTrans::getString("MBAlreadyRunning");
OSMessageBox(
- msg.str(),
+ LLTrans::getString("MBAlreadyRunning"),
LLStringUtil::null,
OSMB_OK);
return false;
@@ -2835,27 +2844,6 @@ bool LLAppViewer::initConfiguration()
}
}
- // NextLoginLocation is set from the command line option
- std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
- if ( !nextLoginLocation.empty() )
- {
- LL_DEBUGS("AppInit")<<"set start from NextLoginLocation: "<<nextLoginLocation<<LL_ENDL;
- LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation));
- }
- else if ( ( clp.hasOption("login") || clp.hasOption("autologin"))
- && gSavedSettings.getString("CmdLineLoginLocation").empty())
- {
- // If automatic login from command line with --login switch
- // init StartSLURL location.
- std::string start_slurl_setting = gSavedSettings.getString("LoginLocation");
- LL_DEBUGS("AppInit") << "start slurl setting '" << start_slurl_setting << "'" << LL_ENDL;
- LLStartUp::setStartSLURL(LLSLURL(start_slurl_setting));
- }
- else
- {
- // the login location will be set by the login panel (see LLPanelLogin)
- }
-
gLastRunVersion = gSavedSettings.getString("LastRunVersion");
loadColorSettings();