diff options
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 504 |
1 files changed, 223 insertions, 281 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 7f4ba2f2d2..43c8c679c6 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2,25 +2,31 @@ * @file llappviewer.cpp * @brief The LLAppViewer class definitions * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, Linden Research, Inc. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -39,7 +45,6 @@ #include "llgroupmgr.h" #include "llagent.h" #include "llagentcamera.h" -#include "llagentlanguage.h" #include "llagentwearables.h" #include "llwindow.h" #include "llviewerstats.h" @@ -76,9 +81,7 @@ #include "llvoicechannel.h" #include "llvoavatarself.h" #include "llsidetray.h" -#include "llfeaturemanager.h" -#include "llurlmatch.h" -#include "lltextutil.h" + #include "llweb.h" #include "llsecondlifeurls.h" @@ -100,8 +103,8 @@ // Third party library includes #include <boost/bind.hpp> - #if LL_WINDOWS + #include "llwindebug.h" # include <share.h> // For _SH_DENYWR in initMarkerFile #else # include <sys/file.h> // For initMarkerFile support @@ -150,7 +153,7 @@ #include "llworld.h" #include "llhudeffecttrail.h" #include "llvectorperfoptions.h" -#include "llslurl.h" +#include "llurlsimstring.h" #include "llwatchdog.h" // Included so that constants/settings might be initialized @@ -189,11 +192,6 @@ #include "llviewerthrottle.h" #include "llparcel.h" #include "llavatariconctrl.h" -#include "llgroupiconctrl.h" - -// Include for security api initialization -#include "llsecapi.h" -#include "llmachineid.h" // *FIX: These extern globals should be cleaned up. // The globals either represent state/config/resource-storage of either @@ -329,6 +327,10 @@ const char *VFS_INDEX_FILE_BASE = "index.db2.x."; static std::string gWindowTitle; +std::string gLoginPage; +std::vector<std::string> gLoginURIs; +static std::string gHelperURI; + LLAppViewer::LLUpdaterInfo *LLAppViewer::sUpdaterInfo = NULL ; void idle_afk_check() @@ -349,45 +351,6 @@ static void ui_audio_callback(const LLUUID& uuid) } } -bool create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base) -{ - if(!match || !base || base->getPlainText()) - return false; - - LLUUID match_id = match->getID(); - - LLIconCtrl* icon; - - if(gAgent.isInGroup(match_id, TRUE)) - { - LLGroupIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLGroupIconCtrl>(); - icon_params.group_id = match_id; - icon_params.rect = LLRect(0, 16, 16, 0); - icon_params.visible = true; - icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params); - } - else - { - LLAvatarIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLAvatarIconCtrl>(); - icon_params.avatar_id = match_id; - icon_params.rect = LLRect(0, 16, 16, 0); - icon_params.visible = true; - icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params); - } - - LLInlineViewSegment::Params params; - params.force_newline = false; - params.view = icon; - params.left_pad = 4; - params.right_pad = 4; - params.top_pad = -2; - params.bottom_pad = 2; - - base->appendWidget(params," ",false); - - return true; -} - void request_initial_instant_messages() { static BOOL requested = FALSE; @@ -416,8 +379,14 @@ bool handleCrashSubmitBehaviorChanged(const LLSD& newvalue) const S32 NEVER_SUBMIT_REPORT = 2; if(cb == NEVER_SUBMIT_REPORT) { +// LLWatchdog::getInstance()->cleanup(); // SJB: cleaning up a running watchdog thread is unsafe LLAppViewer::instance()->destroyMainloopTimeout(); } + else if(gSavedSettings.getBOOL("WatchdogEnabled") == TRUE) + { + // Don't re-enable the watchdog when we change the setting; this may get called before it's started +// LLWatchdog::getInstance()->init(); + } return true; } @@ -443,7 +412,7 @@ static void settings_to_globals() LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor"); LLVOTree::sTreeFactor = gSavedSettings.getF32("RenderTreeLODFactor"); LLVOAvatar::sLODFactor = gSavedSettings.getF32("RenderAvatarLODFactor"); - LLVOAvatar::sMaxVisible = (U32)gSavedSettings.getS32("RenderAvatarMaxVisible"); + LLVOAvatar::sMaxVisible = gSavedSettings.getS32("RenderAvatarMaxVisible"); LLVOAvatar::sVisibleInFirstPerson = gSavedSettings.getBOOL("FirstPersonAvatarVisible"); // clamp auto-open time to some minimum usable value LLFolderView::sAutoOpenTime = llmax(0.25f, gSavedSettings.getF32("FolderAutoOpenDelay")); @@ -538,6 +507,35 @@ public: } }; +void LLAppViewer::initGridChoice() +{ + // Load up the initial grid choice from: + // - hard coded defaults... + // - command line settings... + // - if dev build, persisted settings... + + // Set the "grid choice", this is specified by command line. + std::string grid_choice = gSavedSettings.getString("CmdLineGridChoice"); + LLViewerLogin::getInstance()->setGridChoice(grid_choice); + + // Load last server choice by default + // ignored if the command line grid choice has been set + if(grid_choice.empty()) + { + S32 server = gSavedSettings.getS32("ServerChoice"); + server = llclamp(server, 0, (S32)GRID_INFO_COUNT - 1); + if(server == GRID_INFO_OTHER) + { + std::string custom_server = gSavedSettings.getString("CustomServer"); + LLViewerLogin::getInstance()->setGridChoice(custom_server); + } + else if(server != (S32)GRID_INFO_NONE) + { + LLViewerLogin::getInstance()->setGridChoice((EGridInfo)server); + } + } +} + //virtual bool LLAppViewer::initSLURLHandler() { @@ -630,11 +628,6 @@ bool LLAppViewer::init() if (!initConfiguration()) return false; - // write Google Breakpad minidump files to our log directory - std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ""); - logdir += gDirUtilp->getDirDelimiter(); - setMiniDumpDir(logdir); - // Although initLogging() is the right place to mess with // setFatalFunction(), we can't query gSavedSettings until after // initConfiguration(). @@ -652,9 +645,9 @@ bool LLAppViewer::init() // *NOTE:Mani - LLCurl::initClass is not thread safe. // Called before threads are created. LLCurl::initClass(); - LLMachineID::init(); initThreads(); + writeSystemInfo(); // Build a string representing the current version number. @@ -784,6 +777,10 @@ bool LLAppViewer::init() return false; } + // Always fetch the Ethernet MAC address, needed both for login + // and password load. + LLUUID::getNodeID(gMACAddress); + // Prepare for out-of-memory situations, during which we will crash on // purpose and save a dump. #if LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP @@ -865,7 +862,7 @@ bool LLAppViewer::init() minSpecs += "\n"; unsupported = true; } - if(gSysCPU.getMHz() < minCPU) + if(gSysCPU.getMhz() < minCPU) { minSpecs += LLNotifications::instance().getGlobalString("UnsupportedCPU"); minSpecs += "\n"; @@ -895,7 +892,6 @@ bool LLAppViewer::init() } } - // save the graphics card gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString(); @@ -906,17 +902,6 @@ bool LLAppViewer::init() gSimFrames = (F32)gFrameCount; LLViewerJoystick::getInstance()->init(false); - - try { - initializeSecHandler(); - } - catch (LLProtectedDataException ex) - { - LLNotificationsUtil::add("CorruptedProtectedDataStore"); - } - LLHTTPClient::setCertVerifyCallback(secapiSSLCertVerifyCallback); - - gGLActive = FALSE; if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0) { @@ -924,25 +909,7 @@ bool LLAppViewer::init() } LLViewerMedia::initClass(); - LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match; - - //EXT-7013 - On windows for some locale (Japanese) standard - //datetime formatting functions didn't support some parameters such as "weekday". - std::string language = LLControlGroup::getInstance(sGlobalSettingsName)->getString("Language"); - if(language == "ja") - { - LLStringOps::setupWeekDaysNames(LLTrans::getString("dateTimeWeekdaysNames")); - LLStringOps::setupWeekDaysShortNames(LLTrans::getString("dateTimeWeekdaysShortNames")); - LLStringOps::setupMonthNames(LLTrans::getString("dateTimeMonthNames")); - LLStringOps::setupMonthShortNames(LLTrans::getString("dateTimeMonthShortNames")); - LLStringOps::setupDayFormat(LLTrans::getString("dateTimeDayFormat")); - - LLStringOps::sAM = LLTrans::getString("dateTimeAM"); - LLStringOps::sPM = LLTrans::getString("dateTimePM"); - } - - LLAgentLanguage::init(); - + return true; } @@ -969,11 +936,13 @@ bool LLAppViewer::mainLoop() gServicePump = new LLPumpIO(gAPRPoolp); LLHTTPClient::setPump(*gServicePump); LLCurl::setCAFile(gDirUtilp->getCAFile()); - + LLCurl::setSSLVerify(! gSavedSettings.getBOOL("NoVerifySSLCert")); + // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated. LLVoiceChannel::initClass(); - LLVoiceClient::getInstance()->init(gServicePump); + LLVoiceClient::init(gServicePump); + LLTimer frameTimer,idleTimer; LLTimer debugTime; LLViewerJoystick* joystick(LLViewerJoystick::getInstance()); @@ -1278,14 +1247,6 @@ bool LLAppViewer::cleanup() // workaround for DEV-35406 crash on shutdown LLEventPumps::instance().reset(); - // remove any old breakpad minidump files from the log directory - if (! isError()) - { - std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ""); - logdir += gDirUtilp->getDirDelimiter(); - gDirUtilp->deleteFilesInDir(logdir, "*-*-*-*-*.dmp"); - } - // *TODO - generalize this and move DSO wrangling to a helper class -brad std::set<struct apr_dso_handle_t *>::const_iterator i; for(i = mPlugins.begin(); i != mPlugins.end(); ++i) @@ -1312,7 +1273,7 @@ bool LLAppViewer::cleanup() // to ensure shutdown order LLMortician::setZealous(TRUE); - LLVoiceClient::getInstance()->terminate(); + LLVoiceClient::terminate(); disconnectViewer(); @@ -1511,6 +1472,13 @@ bool LLAppViewer::cleanup() llinfos << "Saving Data" << llendflush; + // Quitting with "Remember Password" turned off should always stomp your + // saved password, whether or not you successfully logged in. JC + if (!gSavedSettings.getBOOL("RememberPassword")) + { + LLStartUp::deletePasswordFromDisk(); + } + // Store the time of our current logoff gSavedPerAccountSettings.setU32("LastLogoff", time_corrected()); @@ -1562,9 +1530,6 @@ bool LLAppViewer::cleanup() LLViewerMedia::saveCookieFile(); - // Stop the plugin read thread if it's running. - LLPluginProcessParent::setUseReadThread(false); - llinfos << "Shutting down Threads" << llendflush; // Let threads finish @@ -1723,6 +1688,14 @@ bool LLAppViewer::initThreads() static const bool enable_threads = true; #endif + const S32 NEVER_SUBMIT_REPORT = 2; + bool use_watchdog = gSavedSettings.getBOOL("WatchdogEnabled"); + bool send_reports = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) != NEVER_SUBMIT_REPORT; + if(use_watchdog && send_reports) + { + LLWatchdog::getInstance()->init(watchdog_killer_callback); + } + LLVFSThread::initClass(enable_threads && false); LLLFSThread::initClass(enable_threads && false); @@ -1858,7 +1831,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, } else { - llinfos << "Cannot load " << full_settings_path << " - No settings found." << llendl; + llwarns << "Cannot load " << full_settings_path << " - No settings found." << llendl; } } else @@ -1951,11 +1924,18 @@ bool LLAppViewer::initConfiguration() } #endif + //*FIX:Mani - Set default to disabling watchdog mainloop + // timeout for mac and linux. There is no call stack info + // on these platform to help debug. #ifndef LL_RELEASE_FOR_DOWNLOAD + gSavedSettings.setBOOL("WatchdogEnabled", FALSE); gSavedSettings.setBOOL("QAMode", TRUE ); - gSavedSettings.setS32("WatchdogEnabled", 0); #endif - + +#ifndef LL_WINDOWS + gSavedSettings.setBOOL("WatchdogEnabled", FALSE); +#endif + gCrashSettings.getControl(CRASH_BEHAVIOR_SETTING)->getSignal()->connect(boost::bind(&handleCrashSubmitBehaviorChanged, _2)); // These are warnings that appear on the first experience of that condition. @@ -2067,6 +2047,7 @@ bool LLAppViewer::initConfiguration() } } + initGridChoice(); // If we have specified crash on startup, set the global so we'll trigger the crash at the right time if(clp.hasOption("crashonstartup")) @@ -2160,17 +2141,30 @@ bool LLAppViewer::initConfiguration() // injection and steal passwords. Phoenix. SL-55321 if(clp.hasOption("url")) { - LLStartUp::setStartSLURL(LLSLURL(clp.getOption("url")[0])); - if(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION) - { - LLGridManager::getInstance()->setGridChoice(LLStartUp::getStartSLURL().getGrid()); - - } + std::string slurl = clp.getOption("url")[0]; + if (LLSLURL::isSLURLCommand(slurl)) + { + LLStartUp::sSLURLCommand = slurl; + } + else + { + LLURLSimString::setString(slurl); + } } else if(clp.hasOption("slurl")) { - LLSLURL start_slurl(clp.getOption("slurl")[0]); - LLStartUp::setStartSLURL(start_slurl); + std::string slurl = clp.getOption("slurl")[0]; + if(LLSLURL::isSLURL(slurl)) + { + if (LLSLURL::isSLURLCommand(slurl)) + { + LLStartUp::sSLURLCommand = slurl; + } + else + { + LLURLSimString::setString(slurl); + } + } } const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent"); @@ -2251,10 +2245,18 @@ bool LLAppViewer::initConfiguration() // 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()) + std::string slurl; + if (!LLStartUp::sSLURLCommand.empty()) + { + slurl = LLStartUp::sSLURLCommand; + } + else if (LLURLSimString::parse()) + { + slurl = LLURLSimString::getURL(); + } + if (!slurl.empty()) { - if (sendURLToOtherInstance(LLStartUp::getStartSLURL().getSLURLString())) + if (sendURLToOtherInstance(slurl)) { // successfully handed off URL to existing instance, exit return false; @@ -2310,9 +2312,9 @@ bool LLAppViewer::initConfiguration() // need to do this here - need to have initialized global settings first std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); - if ( !nextLoginLocation.empty() ) + if ( nextLoginLocation.length() ) { - LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation)); + LLURLSimString::setString( nextLoginLocation ); }; gLastRunVersion = gSavedSettings.getString("LastRunVersion"); @@ -2327,7 +2329,17 @@ void LLAppViewer::checkForCrash(void) { #if LL_SEND_CRASH_REPORTS + //*NOTE:Mani The current state of the crash handler has the MacOSX + // sending all crash reports as freezes, in order to let + // the MacOSX CrashRepoter generate stacks before spawning the + // SL crash logger. + // The Linux and Windows clients generate their own stacks and + // spawn the SL crash logger immediately. This may change in the future. +#if LL_DARWIN + if(gLastExecEvent != LAST_EXEC_NORMAL) +#else if (gLastExecEvent == LAST_EXEC_FROZE) +#endif { llinfos << "Last execution froze, requesting to send crash report." << llendl; // @@ -2383,30 +2395,18 @@ bool LLAppViewer::initWindow() gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight"), FALSE, ignorePixelDepth); - // Need to load feature table before cheking to start watchdog. - const S32 NEVER_SUBMIT_REPORT = 2; - bool use_watchdog = false; - int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled"); - if(watchdog_enabled_setting == -1){ - use_watchdog = !LLFeatureManager::getInstance()->isFeatureAvailable("WatchdogDisabled"); - } - else - { - // The user has explicitly set this setting; always use that value. - use_watchdog = bool(watchdog_enabled_setting); - } - - bool send_reports = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) != NEVER_SUBMIT_REPORT; - if(use_watchdog && send_reports) - { - LLWatchdog::getInstance()->init(watchdog_killer_callback); - } - LLNotificationsUI::LLNotificationManager::getInstance(); + if (gSavedSettings.getBOOL("WindowFullScreen")) + { + // request to go full screen... which will be delayed until login + gViewerWindow->toggleFullscreen(FALSE); + } + if (gSavedSettings.getBOOL("WindowMaximized")) { gViewerWindow->mWindow->maximize(); + gViewerWindow->getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio")); } if (!gNoRender) @@ -2480,10 +2480,11 @@ void LLAppViewer::cleanupSavedSettings() } } - // save window position if not maximized + // save window position if not fullscreen // as we don't track it in callbacks + BOOL fullscreen = gViewerWindow->mWindow->getFullscreen(); BOOL maximized = gViewerWindow->mWindow->getMaximized(); - if (!maximized) + if (!fullscreen && !maximized) { LLCoordScreen window_pos; @@ -2523,7 +2524,7 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["CPUInfo"]["CPUString"] = gSysCPU.getCPUString(); gDebugInfo["CPUInfo"]["CPUFamily"] = gSysCPU.getFamily(); - gDebugInfo["CPUInfo"]["CPUMhz"] = (S32)gSysCPU.getMHz(); + gDebugInfo["CPUInfo"]["CPUMhz"] = gSysCPU.getMhz(); gDebugInfo["CPUInfo"]["CPUAltivec"] = gSysCPU.hasAltivec(); gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE(); gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2(); @@ -2534,9 +2535,9 @@ void LLAppViewer::writeSystemInfo() // The user is not logged on yet, but record the current grid choice login url // which may have been the intended grid. This can b - gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel(); + gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel(); - // *FIX:Mani - move this down in llappviewerwin32 + // *FIX:Mani - move this ddown in llappviewerwin32 #ifdef LL_WINDOWS DWORD thread_id = GetCurrentThreadId(); gDebugInfo["MainloopThreadID"] = (S32)thread_id; @@ -2548,15 +2549,6 @@ void LLAppViewer::writeSystemInfo() // If the crash is handled by LLAppViewer::handleViewerCrash, ie not a freeze, // then the value of "CrashNotHandled" will be set to true. gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true; - - // Insert crash host url (url to post crash log to) if configured. This insures - // that the crash report will go to the proper location in the case of a - // prior freeze. - std::string crashHostUrl = gSavedSettings.get<std::string>("CrashHostUrl"); - if(crashHostUrl != "") - { - gDebugInfo["CrashHostUrl"] = crashHostUrl; - } // Dump some debugging info LL_INFOS("SystemInfo") << LLTrans::getString("APP_NAME") @@ -2578,12 +2570,17 @@ void LLAppViewer::writeSystemInfo() writeDebugInfo(); // Save out debug_info.log early, in case of crash. } +void LLAppViewer::handleSyncViewerCrash() +{ + LLAppViewer* pApp = LLAppViewer::instance(); + // Call to pure virtual, handled by platform specific llappviewer instance. + pApp->handleSyncCrashTrace(); +} + void LLAppViewer::handleViewerCrash() { llinfos << "Handle viewer crash entry." << llendl; - llinfos << "Last render pool type: " << LLPipeline::sCurRenderPoolType << llendl ; - //print out recorded call stacks if there are any. LLError::LLCallStacks::print(); @@ -2601,13 +2598,9 @@ void LLAppViewer::handleViewerCrash() return; } pApp->mReportedCrash = TRUE; - - // Insert crash host url (url to post crash log to) if configured. - std::string crashHostUrl = gSavedSettings.get<std::string>("CrashHostUrl"); - if(crashHostUrl != "") - { - gDebugInfo["CrashHostUrl"] = crashHostUrl; - } + + // Make sure the watchdog gets turned off... +// pApp->destroyMainloopTimeout(); // SJB: Bah. This causes the crash handler to hang, not sure why. //We already do this in writeSystemInfo(), but we do it again here to make /sure/ we have a version //to check against no matter what @@ -2639,12 +2632,6 @@ void LLAppViewer::handleViewerCrash() gDebugInfo["FirstLogin"] = (LLSD::Boolean) gAgent.isFirstLogin(); gDebugInfo["FirstRunThisInstall"] = gSavedSettings.getBOOL("FirstRunThisInstall"); - char *minidump_file = pApp->getMiniDumpFilename(); - if(minidump_file && minidump_file[0] != 0) - { - gDebugInfo["MinidumpPath"] = minidump_file; - } - if(gLogoutInProgress) { gDebugInfo["LastExecEvent"] = LAST_EXEC_LOGOUT_CRASH; @@ -2722,6 +2709,10 @@ void LLAppViewer::handleViewerCrash() LLError::logToFile(""); +// On Mac, we send the report on the next run, since we need macs crash report +// for a stack trace, so we have to let it the app fail. +#if !LL_DARWIN + // Remove the marker file, since otherwise we'll spawn a process that'll keep it locked if(gDebugInfo["LastExecEvent"].asInteger() == LAST_EXEC_LOGOUT_CRASH) { @@ -2734,6 +2725,8 @@ void LLAppViewer::handleViewerCrash() // Call to pure virtual, handled by platform specific llappviewer instance. pApp->handleCrashReporting(); + +#endif //!LL_DARWIN return; } @@ -3023,97 +3016,41 @@ void LLAppViewer::migrateCacheDirectory() #endif // LL_WINDOWS || LL_DARWIN } -//static -S32 LLAppViewer::getCacheVersion() -{ - static const S32 cache_version = 7; - - return cache_version ; -} - -void dumpVFSCaches() +bool LLAppViewer::initCache() { - llinfos << "======= Static VFS ========" << llendl; - gStaticVFS->listFiles(); -#if LL_WINDOWS - llinfos << "======= Dumping static VFS to StaticVFSDump ========" << llendl; - WCHAR w_str[MAX_PATH]; - GetCurrentDirectory(MAX_PATH, w_str); - S32 res = LLFile::mkdir("StaticVFSDump"); - if (res == -1) + mPurgeCache = false; + // Purge cache if user requested it + if (gSavedSettings.getBOOL("PurgeCacheOnStartup") || + gSavedSettings.getBOOL("PurgeCacheOnNextStartup")) { - if (errno != EEXIST) - { - llwarns << "Couldn't create dir StaticVFSDump" << llendl; - } + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false); + mPurgeCache = true; } - SetCurrentDirectory(utf8str_to_utf16str("StaticVFSDump").c_str()); - gStaticVFS->dumpFiles(); - SetCurrentDirectory(w_str); -#endif - - llinfos << "========= Dynamic VFS ====" << llendl; - gVFS->listFiles(); -#if LL_WINDOWS - llinfos << "========= Dumping dynamic VFS to VFSDump ====" << llendl; - res = LLFile::mkdir("VFSDump"); - if (res == -1) + // Purge cache if it belongs to an old version + else { - if (errno != EEXIST) + static const S32 cache_version = 6; + if (gSavedSettings.getS32("LocalCacheVersion") != cache_version) { - llwarns << "Couldn't create dir VFSDump" << llendl; + mPurgeCache = true; + gSavedSettings.setS32("LocalCacheVersion", cache_version); } } - SetCurrentDirectory(utf8str_to_utf16str("VFSDump").c_str()); - gVFS->dumpFiles(); - SetCurrentDirectory(w_str); -#endif -} -bool LLAppViewer::initCache() -{ - mPurgeCache = false; - BOOL disable_texture_cache = FALSE ; - BOOL read_only = mSecondInstance ? TRUE : FALSE; - LLAppViewer::getTextureCache()->setReadOnly(read_only) ; + + // We have moved the location of the cache directory over time. + migrateCacheDirectory(); - if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getCacheVersion()) + // Setup and verify the cache location + std::string cache_location = gSavedSettings.getString("CacheLocation"); + std::string new_cache_location = gSavedSettings.getString("NewCacheLocation"); + if (new_cache_location != cache_location) { - if(read_only) - { - disable_texture_cache = TRUE ; //if the cache version of this viewer is different from the running one, this viewer can not use the texture cache. - } - else - { - mPurgeCache = true; // Purge cache if the version number is different. - gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getCacheVersion()); - } + gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")); + purgeCache(); // purge old cache + gSavedSettings.setString("CacheLocation", new_cache_location); + gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location)); } - - if(!read_only) - { - // Purge cache if user requested it - if (gSavedSettings.getBOOL("PurgeCacheOnStartup") || - gSavedSettings.getBOOL("PurgeCacheOnNextStartup")) - { - gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false); - mPurgeCache = true; - } - // We have moved the location of the cache directory over time. - migrateCacheDirectory(); - - // Setup and verify the cache location - std::string cache_location = gSavedSettings.getString("CacheLocation"); - std::string new_cache_location = gSavedSettings.getString("NewCacheLocation"); - if (new_cache_location != cache_location) - { - gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")); - purgeCache(); // purge old cache - gSavedSettings.setString("CacheLocation", new_cache_location); - gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location)); - } - } - if (!gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"))) { LL_WARNS("AppCache") << "Unable to set cache location" << LL_ENDL; @@ -3121,7 +3058,7 @@ bool LLAppViewer::initCache() gSavedSettings.setString("CacheLocationTopFolder", ""); } - if (mPurgeCache && !read_only) + if (mPurgeCache) { LLSplashScreen::update(LLTrans::getString("StartupClearingCache")); purgeCache(); @@ -3130,13 +3067,14 @@ bool LLAppViewer::initCache() LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache")); // Init the texture cache - // Allocate 80% of the cache size for textures + // Allocate 80% of the cache size for textures + BOOL read_only = mSecondInstance ? TRUE : FALSE; const S32 MB = 1024*1024; S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB; const S64 MAX_CACHE_SIZE = 1024*MB; cache_size = llmin(cache_size, MAX_CACHE_SIZE); S64 texture_cache_size = ((cache_size * 8)/10); - S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, disable_texture_cache); + S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, read_only); texture_cache_size -= extra; LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS")); @@ -3285,14 +3223,6 @@ bool LLAppViewer::initCache() else { LLVFile::initClass(); - -#ifndef LL_RELEASE_FOR_DOWNLOAD - if (gSavedSettings.getBOOL("DumpVFSCaches")) - { - dumpVFSCaches(); - } -#endif - return true; } } @@ -3377,6 +3307,13 @@ void LLAppViewer::badNetworkHandler() mPurgeOnExit = TRUE; +#if LL_WINDOWS + // Generates the minidump. + LLWinDebug::generateCrashStacks(NULL); +#endif + LLAppViewer::handleSyncViewerCrash(); + LLAppViewer::handleViewerCrash(); + std::ostringstream message; message << "The viewer has detected mangled network data indicative\n" @@ -3389,8 +3326,6 @@ void LLAppViewer::badNetworkHandler() "If the problem continues, see the Tech Support FAQ at: \n" "www.secondlife.com/support"; forceDisconnect(message.str()); - - LLApp::instance()->writeMiniDump(); } // This routine may get called more than once during the shutdown process. @@ -3951,7 +3886,7 @@ void LLAppViewer::sendLogoutRequest() gLogoutMaxTime = LOGOUT_REQUEST_TIME; mLogoutRequestSent = TRUE; - LLVoiceClient::getInstance()->leaveChannel(); + gVoiceClient->leaveChannel(); //Set internal status variables and marker files gLogoutInProgress = TRUE; @@ -3989,7 +3924,9 @@ void LLAppViewer::idleNetwork() { LLMemType mt_in(LLMemType::MTYPE_IDLE_NETWORK); pingMainloopTimeout("idleNetwork"); - + LLError::LLCallStacks::clear() ; + llpushcallstacks ; + gObjectList.mNumNewObjects = 0; S32 total_decoded = 0; @@ -3999,6 +3936,7 @@ void LLAppViewer::idleNetwork() // deal with any queued name requests and replies. gCacheName->processPending(); + llpushcallstacks ; LLTimer check_message_timer; // Read all available packets from network const S64 frame_count = gFrameCount; // U32->S64 @@ -4068,13 +4006,16 @@ void LLAppViewer::idleNetwork() gPrintMessagesThisFrame = FALSE; } } + llpushcallstacks ; LLViewerStats::getInstance()->mNumNewObjectsStat.addValue(gObjectList.mNumNewObjects); // Retransmit unacknowledged packets. gXferManager->retransmitUnackedPackets(); gAssetStorage->checkForTimeouts(); + llpushcallstacks ; gViewerThrottle.updateDynamicThrottle(); + llpushcallstacks ; // Check that the circuit between the viewer and the agent's current // region is still alive LLViewerRegion *agent_region = gAgent.getRegion(); @@ -4090,6 +4031,7 @@ void LLAppViewer::idleNetwork() mAgentRegionLastID = this_region_id; mAgentRegionLastAlive = this_region_alive; } + llpushcallstacks ; } void LLAppViewer::disconnectViewer() @@ -4171,7 +4113,7 @@ void LLAppViewer::forceErrorBreakpoint() void LLAppViewer::forceErrorBadMemoryAccess() { S32* crash = NULL; - *crash = 0xDEADBEEF; + *crash = 0xDEADBEEF; return; } @@ -4364,7 +4306,7 @@ void LLAppViewer::launchUpdater() #endif // *TODO change userserver to be grid on both viewer and sim, since // userserver no longer exists. - query_map["userserver"] = LLGridManager::getInstance()->getGridLabel(); + query_map["userserver"] = LLViewerLogin::getInstance()->getGridLabel(); query_map["channel"] = gSavedSettings.getString("VersionChannelName"); // *TODO constantize this guy // *NOTE: This URL is also used in win_setup/lldownloader.cpp @@ -4377,10 +4319,10 @@ void LLAppViewer::launchUpdater() LLAppViewer::sUpdaterInfo = new LLAppViewer::LLUpdaterInfo() ; // if a sim name was passed in via command line parameter (typically through a SLURL) - if ( LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION ) + if ( LLURLSimString::sInstance.mSimString.length() ) { // record the location to start at next time - gSavedSettings.setString( "NextLoginLocation", LLStartUp::getStartSLURL().getSLURLString()); + gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString ); }; #if LL_WINDOWS |