diff options
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 244 |
1 files changed, 140 insertions, 104 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 85ede793e2..262ab439b4 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -340,24 +340,23 @@ F32 gLogoutMaxTime = LOGOUT_REQUEST_TIME; S32 gPendingMetricsUploads = 0; -bool gDisconnected = false; +bool gDisconnected = false; -// used to restore texture state after a mode switch -LLFrameTimer gRestoreGLTimer; -bool gRestoreGL = false; -bool gUseWireframe = false; +// Used to restore texture state after a mode switch +LLFrameTimer gRestoreGLTimer; +bool gRestoreGL = false; +bool gUseWireframe = false; -LLMemoryInfo gSysMemory; U64Bytes gMemoryAllocated(0); // updated in display_stats() in llviewerdisplay.cpp std::string gLastVersionChannel; -LLVector3 gWindVec(3.0, 3.0, 0.0); -LLVector3 gRelativeWindVec(0.0, 0.0, 0.0); +LLVector3 gWindVec(3.0, 3.0, 0.0); +LLVector3 gRelativeWindVec(0.0, 0.0, 0.0); -U32 gPacketsIn = 0; +U32 gPacketsIn = 0; -bool gPrintMessagesThisFrame = false; +bool gPrintMessagesThisFrame = false; bool gRandomizeFramerate = false; bool gPeriodicSlowFrame = false; @@ -456,7 +455,7 @@ void idle_afk_check() { // check idle timers F32 current_idle = gAwayTriggerTimer.getElapsedTimeF32(); - F32 afk_timeout = gSavedSettings.getS32("AFKTimeout"); + F32 afk_timeout = (F32)gSavedSettings.getS32("AFKTimeout"); if (afk_timeout && (current_idle > afk_timeout) && ! gAgent.getAFK()) { LL_INFOS("IdleAway") << "Idle more than " << afk_timeout << " seconds: automatically changing to Away status" << LL_ENDL; @@ -647,6 +646,7 @@ LLAppViewer::LLAppViewer() mSavedFinalSnapshot(false), mSavePerAccountSettings(false), // don't save settings on logout unless login succeeded. mQuitRequested(false), + mClosingFloaters(false), mLogoutRequestSent(false), mLastAgentControlFlags(0), mLastAgentForceUpdate(0), @@ -752,7 +752,9 @@ bool LLAppViewer::init() // inits from settings.xml and from strings.xml if (!initConfiguration()) - return false; + { + LL_ERRS("InitInfo") << "initConfiguration() failed." << LL_ENDL; + } LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ; @@ -760,7 +762,6 @@ bool LLAppViewer::init() initMaxHeapSize() ; LLCoros::instance().setStackSize(gSavedSettings.getS32("CoroutineStackSize")); - // Although initLoggingAndGetLastDuration() is the right place to mess with // setFatalFunction(), we can't query gSavedSettings until after // initConfiguration(). @@ -783,14 +784,12 @@ bool LLAppViewer::init() LLMachineID::init(); + if (gSavedSettings.getBOOL("QAModeMetrics")) { - if (gSavedSettings.getBOOL("QAModeMetrics")) - { - app_metrics_qa_mode = true; - app_metrics_interval = METRICS_INTERVAL_QA; - } - LLViewerAssetStatsFF::init(); + app_metrics_qa_mode = true; + app_metrics_interval = METRICS_INTERVAL_QA; } + LLViewerAssetStatsFF::init(); initThreads(); LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ; @@ -803,7 +802,7 @@ bool LLAppViewer::init() settings_map["floater"] = &gSavedSettings; // *TODO: New settings file settings_map["account"] = &gSavedPerAccountSettings; - LLUI::initParamSingleton(settings_map, + LLUI::createInstance(settings_map, LLUIImageList::getInstance(), ui_audio_callback, deferred_ui_audio_callback); @@ -906,10 +905,10 @@ bool LLAppViewer::init() // do any necessary set-up for accepting incoming SLURLs from apps initSLURLHandler(); - if(false == initHardwareTest()) + if (!initHardwareTest()) { // Early out from user choice. - return false; + LL_ERRS("InitInfo") << "initHardwareTest() failed." << LL_ENDL; } LL_INFOS("InitInfo") << "Hardware test initialization done." << LL_ENDL ; @@ -923,11 +922,9 @@ bool LLAppViewer::init() if (!initCache()) { - LL_WARNS("InitInfo") << "Failed to init cache" << LL_ENDL; - std::ostringstream msg; - msg << LLTrans::getString("MBUnableToAccessFile"); - OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); - return 0; + std::string msg = LLTrans::getString("MBUnableToAccessFile"); + OSMessageBox(msg.c_str(), LLStringUtil::null, OSMB_OK); + LL_ERRS("InitInfo") << "Failed to init cache" << LL_ENDL; } LL_INFOS("InitInfo") << "Cache initialization is done." << LL_ENDL ; @@ -956,10 +953,11 @@ bool LLAppViewer::init() gGLManager.printGLInfoString(); // If we don't have the right GL requirements, exit. + // ? AG: It seems we never set mHasRequirements to false if (!gGLManager.mHasRequirements) { - // already handled with a MBVideoDrvErr - return 0; + // Already handled with a MBVideoDrvErr + LL_ERRS("InitInfo") << "gGLManager.mHasRequirements is false." << LL_ENDL; } // Without SSE2 support we will crash almost immediately, warn here. @@ -967,15 +965,13 @@ bool LLAppViewer::init() { // can't use an alert here since we're exiting and // all hell breaks lose. - OSMessageBox( - LLNotifications::instance().getGlobalString("UnsupportedCPUSSE2"), - LLStringUtil::null, - OSMB_OK); - return 0; + std::string msg = LLNotifications::instance().getGlobalString("UnsupportedCPUSSE2"); + OSMessageBox(msg.c_str(), LLStringUtil::null, OSMB_OK); + LL_ERRS("InitInfo") << "SSE2 is not supported" << LL_ENDL; } // alert the user if they are using unsupported hardware - if(!gSavedSettings.getBOOL("AlertedUnsupportedHardware")) + if (!gSavedSettings.getBOOL("AlertedUnsupportedHardware")) { bool unsupported = false; LLSD args; @@ -991,19 +987,21 @@ bool LLAppViewer::init() U64Bytes minRAM; minRAMString >> minRAM; - if(!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN) + if (!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN) { minSpecs += LLNotifications::instance().getGlobalString("UnsupportedGPU"); minSpecs += "\n"; unsupported = true; } - if(gSysCPU.getMHz() < minCPU) + + if (gSysCPU.getMHz() < minCPU) { minSpecs += LLNotifications::instance().getGlobalString("UnsupportedCPU"); minSpecs += "\n"; unsupported = true; } - if(gSysMemory.getPhysicalMemoryKB() < minRAM) + + if (gSysMemory.getPhysicalMemoryKB() < minRAM) { minSpecs += LLNotifications::instance().getGlobalString("UnsupportedRAM"); minSpecs += "\n"; @@ -1015,15 +1013,14 @@ bool LLAppViewer::init() LLNotificationsUtil::add("UnknownGPU"); } - if(unsupported) + if (unsupported) { - if(!gSavedSettings.controlExists("WarnUnsupportedHardware") + if (!gSavedSettings.controlExists("WarnUnsupportedHardware") || gSavedSettings.getBOOL("WarnUnsupportedHardware")) { args["MINSPECS"] = minSpecs; LLNotificationsUtil::add("UnsupportedHardware", args ); } - } } @@ -1115,12 +1112,13 @@ bool LLAppViewer::init() LLViewerJoystick::getInstance()->init(false); } - try { + try + { initializeSecHandler(); } catch (LLProtectedDataException&) { - LLNotificationsUtil::add("CorruptedProtectedDataStore"); + LLNotificationsUtil::add("CorruptedProtectedDataStore"); } gGLActive = false; @@ -1227,7 +1225,7 @@ bool LLAppViewer::init() //datetime formatting functions didn't support some parameters such as "weekday". //Names for days and months localized in xml are also useful for Polish locale(STORM-107). std::string language = gSavedSettings.getString("Language"); - if(language == "ja" || language == "pl") + if (language == "ja" || language == "pl") { LLStringOps::setupWeekDaysNames(LLTrans::getString("dateTimeWeekdaysNames")); LLStringOps::setupWeekDaysShortNames(LLTrans::getString("dateTimeWeekdaysShortNames")); @@ -1431,13 +1429,13 @@ bool LLAppViewer::doFrame() } { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df mainloop") + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df mainloop"); // canonical per-frame event mainloop.post(newFrame); } { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df suspend") + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df suspend"); // give listeners a chance to run llcoro::suspend(); // if one of our coroutines threw an uncaught exception, rethrow it now @@ -1447,7 +1445,7 @@ bool LLAppViewer::doFrame() if (!LLApp::isExiting()) { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df JoystickKeyboard" ) + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df JoystickKeyboard"); pingMainloopTimeout("Main:JoystickKeyboard"); // Scan keyboard for movement keys. Command keys and typing @@ -1470,7 +1468,7 @@ bool LLAppViewer::doFrame() // Update state based on messages, user input, object idle. { { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df pauseMainloopTimeout" ) + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df pauseMainloopTimeout"); pauseMainloopTimeout(); // *TODO: Remove. Messages shouldn't be stalling for 20+ seconds! } @@ -1481,7 +1479,7 @@ bool LLAppViewer::doFrame() } { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df resumeMainloopTimeout" ) + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df resumeMainloopTimeout"); resumeMainloopTimeout(); } } @@ -1528,7 +1526,7 @@ bool LLAppViewer::doFrame() } { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df pauseMainloopTimeout" ) + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df pauseMainloopTimeout"); pingMainloopTimeout("Main:Sleep"); pauseMainloopTimeout(); @@ -1537,14 +1535,14 @@ bool LLAppViewer::doFrame() // Sleep and run background threads { //LL_RECORD_BLOCK_TIME(SLEEP2); - LL_PROFILE_ZONE_WARN( "Sleep2" ) + LL_PROFILE_ZONE_WARN("Sleep2"); // yield some time to the os based on command line option static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime", -1); if(yield_time >= 0) { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Yield"); - LL_PROFILE_ZONE_NUM( yield_time ) + LL_PROFILE_ZONE_NUM(yield_time); ms_sleep(yield_time); } @@ -1612,24 +1610,24 @@ bool LLAppViewer::doFrame() } { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df gMeshRepo" ) + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df gMeshRepo"); gMeshRepo.update() ; } if(!total_work_pending) //pause texture fetching threads if nothing to process. { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df getTextureCache" ) + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df getTextureCache"); LLAppViewer::getTextureCache()->pause(); LLAppViewer::getTextureFetch()->pause(); } if(!total_io_pending) //pause file threads if nothing to process. { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df LLVFSThread" ) + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df LLVFSThread"); LLLFSThread::sLocal->pause(); } { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df resumeMainloopTimeout" ) + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df resumeMainloopTimeout"); resumeMainloopTimeout(); } pingMainloopTimeout("Main:End"); @@ -1657,7 +1655,7 @@ bool LLAppViewer::doFrame() LL_INFOS() << "Exiting main_loop" << LL_ENDL; } }LLPerfStats::StatsRecorder::endFrame(); - LL_PROFILER_FRAME_END + LL_PROFILER_FRAME_END; return ! LLApp::isRunning(); } @@ -1942,7 +1940,7 @@ bool LLAppViewer::cleanup() LL_INFOS() << "Saving Data" << LL_ENDL; // Store the time of our current logoff - gSavedPerAccountSettings.setU32("LastLogoff", time_corrected()); + gSavedPerAccountSettings.setU32("LastLogoff", (U32)time_corrected()); if (LLEnvironment::instanceExists()) { @@ -2157,6 +2155,7 @@ bool LLAppViewer::cleanup() LLViewerEventRecorder::deleteSingleton(); LLWorld::deleteSingleton(); LLVoiceClient::deleteSingleton(); + LLUI::deleteSingleton(); // It's not at first obvious where, in this long sequence, a generic cleanup // call OUGHT to go. So let's say this: as we migrate cleanup from @@ -2210,10 +2209,10 @@ bool LLAppViewer::initThreads() cores = llmin(cores, (S32) max_cores); } - // The only configurable thread count right now is ImageDecode - // The viewer typically starts around 8 threads not including image decode, - // so try to leave at least one core free - S32 image_decode_count = llclamp(cores - 9, 1, 8); + // always use at least 2 threads for image decoding to prevent + // a single texture blocking all other textures from decoding + S32 image_decode_count = llclamp(cores - 6, 2, 16); + threadCounts["ImageDecode"] = image_decode_count; gSavedSettings.setLLSD("ThreadPoolSizes", threadCounts); @@ -2251,7 +2250,9 @@ void errorCallback(LLError::ELevel level, const std::string &error_string) if (level == LLError::LEVEL_ERROR) { #ifndef LL_RELEASE_FOR_DOWNLOAD - OSMessageBox(error_string, LLTrans::getString("MBFatalError"), OSMB_OK); + std::string message = error_string + + "\n\n\nThis is a developer-only notification!\nThis notification won't be present in Release for download build"; + OSMessageBox(message, LLTrans::getString("MBFatalError"), OSMB_OK); #endif gDebugInfo["FatalMessage"] = error_string; @@ -2315,7 +2316,7 @@ void LLAppViewer::initLoggingAndGetLastDuration() int log_stat_result = LLFile::stat(log_file, &log_file_stat); if (0 == start_stat_result && 0 == log_stat_result) { - int elapsed_seconds = log_file_stat.st_ctime - start_marker_stat.st_ctime; + int elapsed_seconds = (int)(log_file_stat.st_ctime - start_marker_stat.st_ctime); // only report a last run time if the last viewer was the same version // because this stat will be counted against this version if (markerIsSameVersion(start_marker_file_name)) @@ -2393,7 +2394,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, std::string full_settings_path; if (file.file_name_setting.isProvided() - && gSavedSettings.controlExists(file.file_name_setting)) + && gSavedSettings.controlExists(file.file_name_setting())) { // try to find filename stored in file_name_setting control full_settings_path = gSavedSettings.getString(file.file_name_setting()); @@ -2513,7 +2514,7 @@ bool tempSetControl(const std::string& name, const std::string& value) bool LLAppViewer::initConfiguration() { - //Load settings files list + // Load settings files list std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml"); LLXMLNodePtr root; bool success = LLXMLNode::parseFile(settings_file_list, root, NULL); @@ -2560,7 +2561,7 @@ bool LLAppViewer::initConfiguration() // - load defaults bool set_defaults = true; - if(!loadSettingsFromDirectory("Default", set_defaults)) + if (!loadSettingsFromDirectory("Default", set_defaults)) { OSMessageBox( "Unable to load default settings file. The installation may be corrupted.", @@ -2577,13 +2578,12 @@ bool LLAppViewer::initConfiguration() #ifndef LL_RELEASE_FOR_DOWNLOAD // provide developer build only overrides for these control variables that are not // persisted to settings.xml - LLControlVariable* c = gSavedSettings.getControl("AllowMultipleViewers"); - if (c) + if (LLControlVariable* c = gSavedSettings.getControl("AllowMultipleViewers")) { c->setValue(true, false); } - gSavedSettings.setBOOL("QAMode", true ); + gSavedSettings.setBOOL("QAMode", true); gSavedSettings.setS32("WatchdogEnabled", 0); #endif @@ -2616,7 +2616,7 @@ bool LLAppViewer::initConfiguration() clp.configure(cmd_line_config, &gSavedSettings); - if(!initParseCommandLine(clp)) + if (!initParseCommandLine(clp)) { handleCommandLineError(clp); return false; @@ -2626,7 +2626,7 @@ bool LLAppViewer::initConfiguration() // If the user has specified a alternate settings file name. // Load it now before loading the user_settings/settings.xml - if(clp.hasOption("settings")) + if (clp.hasOption("settings")) { std::string user_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, @@ -2668,7 +2668,7 @@ bool LLAppViewer::initConfiguration() loadSettingsFromDirectory("UserSession"); // - apply command line settings - if (! clp.notify()) + if (!clp.notify()) { handleCommandLineError(clp); return false; @@ -2677,7 +2677,7 @@ bool LLAppViewer::initConfiguration() // Register the core crash option as soon as we can // if we want gdb post-mortem on cores we need to be up and running // ASAP or we might miss init issue etc. - if(gSavedSettings.getBOOL("DisableCrashLogger")) + if (gSavedSettings.getBOOL("DisableCrashLogger")) { LL_WARNS() << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << LL_ENDL; disableCrashlogger(); @@ -2691,7 +2691,7 @@ bool LLAppViewer::initConfiguration() initConsole(); } - if(clp.hasOption("help")) + if (clp.hasOption("help")) { std::ostringstream msg; msg << LLTrans::getString("MBCmdLineUsg") << "\n" << clp; @@ -2705,17 +2705,17 @@ bool LLAppViewer::initConfiguration() return false; } - if(clp.hasOption("set")) + if (clp.hasOption("set")) { const LLCommandLineParser::token_vector_t& set_values = clp.getOption("set"); - if(0x1 & set_values.size()) + if (0x1 & set_values.size()) { LL_WARNS() << "Invalid '--set' parameter count." << LL_ENDL; } else { LLCommandLineParser::token_vector_t::const_iterator itr = set_values.begin(); - for(; itr != set_values.end(); ++itr) + for (; itr != set_values.end(); ++itr) { const std::string& name = *itr; const std::string& value = *(++itr); @@ -2727,12 +2727,13 @@ bool LLAppViewer::initConfiguration() } } - if (clp.hasOption("logevents")) { + if (clp.hasOption("logevents")) + { LLViewerEventRecorder::instance().setEventLoggingOn(); } std::string CmdLineChannel(gSavedSettings.getString("CmdLineChannel")); - if(! CmdLineChannel.empty()) + if (!CmdLineChannel.empty()) { LLVersionInfo::instance().resetChannel(CmdLineChannel); } @@ -2747,7 +2748,7 @@ bool LLAppViewer::initConfiguration() } std::string test_name(gSavedSettings.getString("LogMetrics")); - if (! test_name.empty()) + if (!test_name.empty()) { LLTrace::BlockTimer::sMetricLog = true; // '--logmetrics' is specified with a named test metric argument so the data gathering is done only on that test @@ -2789,7 +2790,7 @@ bool LLAppViewer::initConfiguration() } const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent"); - if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) + 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 @@ -2823,7 +2824,6 @@ bool LLAppViewer::initConfiguration() llassert_always(!gSavedSettings.getBOOL("SLURLPassToOtherInstance")); } - // Handle slurl use. NOTE: Don't let SL-55321 reappear. // This initial-SLURL logic, up through the call to // sendURLToOtherInstance(), must precede LLSplashScreen::show() -- @@ -2849,21 +2849,21 @@ bool LLAppViewer::initConfiguration() std::string starting_location; std::string cmd_line_login_location(gSavedSettings.getString("CmdLineLoginLocation")); - if(! cmd_line_login_location.empty()) + if (!cmd_line_login_location.empty()) { starting_location = cmd_line_login_location; } else { std::string default_login_location(gSavedSettings.getString("DefaultLoginLocation")); - if (! default_login_location.empty()) + if (!default_login_location.empty()) { starting_location = default_login_location; } } LLSLURL start_slurl; - if (! starting_location.empty()) + if (!starting_location.empty()) { start_slurl = starting_location; LLStartUp::setStartSLURL(start_slurl); @@ -2875,12 +2875,12 @@ bool LLAppViewer::initConfiguration() // NextLoginLocation is set as a side effect of LLStartUp::setStartSLURL() std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); - if ( !nextLoginLocation.empty() ) + 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")) + else if ((clp.hasOption("login") || clp.hasOption("autologin")) && gSavedSettings.getString("CmdLineLoginLocation").empty()) { // If automatic login from command line with --login switch @@ -2936,7 +2936,7 @@ bool LLAppViewer::initConfiguration() #endif if (!gArgs.empty()) { - gWindowTitle += std::string(" ") + gArgs; + gWindowTitle += std::string(" ") + gArgs; } LLStringUtil::truncate(gWindowTitle, 255); @@ -2960,7 +2960,7 @@ bool LLAppViewer::initConfiguration() // but make sure the setting is *not* persisted. // Also see LLVivoxVoiceClient::voiceEnabled() LLControlVariable* enable_voice = gSavedSettings.getControl("EnableVoiceChat"); - if(enable_voice) + if (enable_voice) { const bool DO_NOT_PERSIST = false; enable_voice->setValue(LLSD(false), DO_NOT_PERSIST); @@ -3071,6 +3071,13 @@ bool LLAppViewer::meetsRequirementsForMaximizedStart() return maximizedOk; } +// virtual +void LLAppViewer::sendOutOfDiskSpaceNotification() +{ + LL_WARNS() << "Out of disk space notification requested" << LL_ENDL; + LLNotificationsUtil::add("OutOfDiskSpace"); +} + bool LLAppViewer::initWindow() { LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL; @@ -3164,8 +3171,8 @@ bool LLAppViewer::initWindow() gSavedSettings.setBOOL("RenderInitError", false); gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), true ); - //If we have a startup crash, it's usually near GL initialization, so simulate that. - if(gCrashOnStartup) + // If we have a startup crash, it's usually near GL initialization, so simulate that. + if (gCrashOnStartup) { LLAppViewer::instance()->forceErrorLLError(); } @@ -3418,7 +3425,7 @@ LLSD LLAppViewer::getViewerInfo() const info["LIBVLC_VERSION"] = "Undefined"; #endif - S32 packets_in = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN); + S32 packets_in = (S32)LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN); if (packets_in > 0) { info["PACKETS_LOST"] = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_LOST); @@ -3990,11 +3997,11 @@ void LLAppViewer::requestQuit() LLViewerRegion* region = gAgent.getRegion(); - if( (LLStartUp::getStartupState() < STATE_STARTED) || !region ) + if ((LLStartUp::getStartupState() < STATE_STARTED) || !region) { // If we have a region, make some attempt to send a logout request first. // This prevents the halfway-logged-in avatar from hanging around inworld for a couple minutes. - if(region) + if (region) { sendLogoutRequest(); } @@ -4025,6 +4032,7 @@ void LLAppViewer::requestQuit() { // application is quitting gFloaterView->closeAllChildren(true); + mClosingFloaters = true; } // Send preferences once, when exiting @@ -4088,6 +4096,7 @@ void LLAppViewer::abortQuit() { LL_INFOS() << "abortQuit()" << LL_ENDL; mQuitRequested = false; + mClosingFloaters = false; } void LLAppViewer::migrateCacheDirectory() @@ -4609,6 +4618,10 @@ void LLAppViewer::idle() LLGLTFMaterialList::flushUpdates(); + static LLCachedControl<U32> downscale_method(gSavedSettings, "RenderDownScaleMethod"); + gGLManager.mDownScaleMethod = downscale_method; + LLImageGL::updateClass(); + // Service the WorkQueue we use for replies from worker threads. // Use function statics for the timeslice setting so we only have to fetch // and convert MainWorkTime once. @@ -5033,15 +5046,21 @@ void LLAppViewer::idleShutdown() } // Wait for all floaters to get resolved - if (gFloaterView - && !gFloaterView->allChildrenClosed()) + if (gFloaterView) { - return; + if (!mClosingFloaters) + { + // application is quitting + gFloaterView->closeAllChildren(true); + mClosingFloaters = true; + return; + } + if (!gFloaterView->allChildrenClosed()) + { + return; + } } - - - // ProductEngine: Try moving this code to where we shut down sTextureCache in cleanup() // *TODO: ugly static bool saved_teleport_history = false; @@ -5090,7 +5109,7 @@ void LLAppViewer::idleShutdown() } // All floaters are closed. Tell server we want to quit. - if( !logoutRequestSent() ) + if (!logoutRequestSent()) { sendLogoutRequest(); @@ -5102,8 +5121,8 @@ void LLAppViewer::idleShutdown() } // Make sure that we quit if we haven't received a reply from the server. - if( logoutRequestSent() - && gLogoutTimer.getElapsedTimeF32() > gLogoutMaxTime ) + if (logoutRequestSent() + && gLogoutTimer.getElapsedTimeF32() > gLogoutMaxTime) { forceQuit(); return; @@ -5200,6 +5219,23 @@ void LLAppViewer::postToMainCoro(const LL::WorkQueue::Work& work) gMainloopWork.post(work); } +void LLAppViewer::outOfMemorySoftQuit() +{ + if (!mQuitRequested) + { + // Todo: + // Find a way to free at least some memory to make it safer + // Pause decoding and mesh repositorie + getTextureCache()->pause(); + getTextureFetch()->pause(); + LLLFSThread::sLocal->pause(); + gLogoutTimer.reset(); + mQuitRequested = true; + + LLError::LLUserWarningMsg::showOutOfMemory(); + } +} + void LLAppViewer::idleNameCache() { // Neither old nor new name cache can function before agent has a region |