diff options
author | Jacek Antonelli | 2008-12-01 17:39:58 -0600 |
---|---|---|
committer | Jacek Antonelli | 2008-12-01 17:40:06 -0600 |
commit | 7abecb48babe6a6f09bf6692ba55076546cfced9 (patch) | |
tree | 8d18a88513fb97adf32c10aae78f4be1984942db /linden/indra/newview/llappviewer.cpp | |
parent | Second Life viewer sources 1.21.6 (diff) | |
download | meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.zip meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.gz meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.bz2 meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.xz |
Second Life viewer sources 1.22.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llappviewer.cpp | 226 |
1 files changed, 103 insertions, 123 deletions
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index f1b2e32..49991b4 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp | |||
@@ -191,18 +191,11 @@ | |||
191 | 191 | ||
192 | //---------------------------------------------------------------------------- | 192 | //---------------------------------------------------------------------------- |
193 | // viewer.cpp - these are only used in viewer, should be easily moved. | 193 | // viewer.cpp - these are only used in viewer, should be easily moved. |
194 | extern void disable_win_error_reporting(); | ||
195 | 194 | ||
196 | #if LL_DARWIN | 195 | #if LL_DARWIN |
197 | #include <Carbon/Carbon.h> | ||
198 | extern void init_apple_menu(const char* product); | 196 | extern void init_apple_menu(const char* product); |
199 | extern OSErr AEGURLHandler(const AppleEvent *messagein, AppleEvent *reply, long refIn); | ||
200 | extern OSErr AEQuitHandler(const AppleEvent *messagein, AppleEvent *reply, long refIn); | ||
201 | extern OSStatus simpleDialogHandler(EventHandlerCallRef handler, EventRef event, void *userdata); | ||
202 | #include <boost/tokenizer.hpp> | ||
203 | #endif // LL_DARWIN | 197 | #endif // LL_DARWIN |
204 | 198 | ||
205 | |||
206 | extern BOOL gRandomizeFramerate; | 199 | extern BOOL gRandomizeFramerate; |
207 | extern BOOL gPeriodicSlowFrame; | 200 | extern BOOL gPeriodicSlowFrame; |
208 | extern BOOL gDebugGL; | 201 | extern BOOL gDebugGL; |
@@ -216,10 +209,6 @@ const F32 DEFAULT_AFK_TIMEOUT = 5.f * 60.f; // time with no input before user fl | |||
216 | F32 gSimLastTime; // Used in LLAppViewer::init and send_stats() | 209 | F32 gSimLastTime; // Used in LLAppViewer::init and send_stats() |
217 | F32 gSimFrames; | 210 | F32 gSimFrames; |
218 | 211 | ||
219 | std::string gDisabledMessage; // Set in LLAppViewer::initConfiguration used in idle_startup | ||
220 | |||
221 | BOOL gHideLinks = FALSE; // Set in LLAppViewer::initConfiguration, used externally | ||
222 | |||
223 | BOOL gAllowIdleAFK = TRUE; | 212 | BOOL gAllowIdleAFK = TRUE; |
224 | BOOL gAllowTapTapHoldRun = TRUE; | 213 | BOOL gAllowTapTapHoldRun = TRUE; |
225 | BOOL gShowObjectUpdates = FALSE; | 214 | BOOL gShowObjectUpdates = FALSE; |
@@ -307,14 +296,13 @@ const char *VFS_INDEX_FILE_BASE = "index.db2.x."; | |||
307 | 296 | ||
308 | static std::string gSecondLife; | 297 | static std::string gSecondLife; |
309 | static std::string gWindowTitle; | 298 | static std::string gWindowTitle; |
310 | #ifdef LL_WINDOWS | ||
311 | static char sWindowClass[] = "Second Life"; | ||
312 | #endif | ||
313 | 299 | ||
314 | std::string gLoginPage; | 300 | std::string gLoginPage; |
315 | std::vector<std::string> gLoginURIs; | 301 | std::vector<std::string> gLoginURIs; |
316 | static std::string gHelperURI; | 302 | static std::string gHelperURI; |
317 | 303 | ||
304 | LLAppViewer::LLUpdaterInfo *LLAppViewer::sUpdaterInfo = NULL ; | ||
305 | |||
318 | void idle_afk_check() | 306 | void idle_afk_check() |
319 | { | 307 | { |
320 | // check idle timers | 308 | // check idle timers |
@@ -329,8 +317,7 @@ static void ui_audio_callback(const LLUUID& uuid) | |||
329 | { | 317 | { |
330 | if (gAudiop) | 318 | if (gAudiop) |
331 | { | 319 | { |
332 | F32 volume = gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI"); | 320 | gAudiop->triggerSound(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI); |
333 | gAudiop->triggerSound(uuid, gAgent.getID(), volume); | ||
334 | } | 321 | } |
335 | } | 322 | } |
336 | 323 | ||
@@ -496,30 +483,17 @@ void LLAppViewer::initGridChoice() | |||
496 | } | 483 | } |
497 | } | 484 | } |
498 | 485 | ||
499 | bool send_url_to_other_instance(const std::string& url) | 486 | //virtual |
487 | bool LLAppViewer::initSLURLHandler() | ||
500 | { | 488 | { |
501 | #if LL_WINDOWS | 489 | // does nothing unless subclassed |
502 | wchar_t window_class[256]; /* Flawfinder: ignore */ // Assume max length < 255 chars. | 490 | return false; |
503 | mbstowcs(window_class, sWindowClass, 255); | 491 | } |
504 | window_class[255] = 0; | 492 | |
505 | // Use the class instead of the window name. | 493 | //virtual |
506 | HWND other_window = FindWindow(window_class, NULL); | 494 | bool LLAppViewer::sendURLToOtherInstance(const std::string& url) |
507 | 495 | { | |
508 | if (other_window != NULL) | 496 | // does nothing unless subclassed |
509 | { | ||
510 | lldebugs << "Found other window with the name '" << gWindowTitle << "'" << llendl; | ||
511 | COPYDATASTRUCT cds; | ||
512 | const S32 SLURL_MESSAGE_TYPE = 0; | ||
513 | cds.dwData = SLURL_MESSAGE_TYPE; | ||
514 | cds.cbData = url.length() + 1; | ||
515 | cds.lpData = (void*)url.c_str(); | ||
516 | |||
517 | LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); | ||
518 | lldebugs << "SendMessage(WM_COPYDATA) to other window '" | ||
519 | << gWindowTitle << "' returned " << msg_result << llendl; | ||
520 | return true; | ||
521 | } | ||
522 | #endif | ||
523 | return false; | 497 | return false; |
524 | } | 498 | } |
525 | 499 | ||
@@ -683,6 +657,7 @@ bool LLAppViewer::init() | |||
683 | ui_audio_callback, | 657 | ui_audio_callback, |
684 | &LLUI::sGLScaleFactor); | 658 | &LLUI::sGLScaleFactor); |
685 | LLWeb::initClass(); // do this after LLUI | 659 | LLWeb::initClass(); // do this after LLUI |
660 | |||
686 | LLTextEditor::setURLCallbacks(&LLWeb::loadURL, | 661 | LLTextEditor::setURLCallbacks(&LLWeb::loadURL, |
687 | &LLURLDispatcher::dispatchFromTextEditor, | 662 | &LLURLDispatcher::dispatchFromTextEditor, |
688 | &LLURLDispatcher::dispatchFromTextEditor); | 663 | &LLURLDispatcher::dispatchFromTextEditor); |
@@ -703,7 +678,6 @@ bool LLAppViewer::init() | |||
703 | // load MIME type -> media impl mappings | 678 | // load MIME type -> media impl mappings |
704 | LLMIMETypes::parseMIMETypes( std::string("mime_types.xml") ); | 679 | LLMIMETypes::parseMIMETypes( std::string("mime_types.xml") ); |
705 | 680 | ||
706 | |||
707 | // Copy settings to globals. *TODO: Remove or move to appropriage class initializers | 681 | // Copy settings to globals. *TODO: Remove or move to appropriage class initializers |
708 | settings_to_globals(); | 682 | settings_to_globals(); |
709 | // Setup settings listeners | 683 | // Setup settings listeners |
@@ -714,6 +688,9 @@ bool LLAppViewer::init() | |||
714 | // Find partition serial number (Windows) or hardware serial (Mac) | 688 | // Find partition serial number (Windows) or hardware serial (Mac) |
715 | mSerialNumber = generateSerialNumber(); | 689 | mSerialNumber = generateSerialNumber(); |
716 | 690 | ||
691 | // do any necessary set-up for accepting incoming SLURLs from apps | ||
692 | initSLURLHandler(); | ||
693 | |||
717 | if(false == initHardwareTest()) | 694 | if(false == initHardwareTest()) |
718 | { | 695 | { |
719 | // Early out from user choice. | 696 | // Early out from user choice. |
@@ -844,7 +821,10 @@ bool LLAppViewer::init() | |||
844 | } | 821 | } |
845 | 822 | ||
846 | } | 823 | } |
847 | 824 | ||
825 | // save the graphics card | ||
826 | gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString(); | ||
827 | |||
848 | // Save the current version to the prefs file | 828 | // Save the current version to the prefs file |
849 | gSavedSettings.setString("LastRunVersion", gCurrentVersion); | 829 | gSavedSettings.setString("LastRunVersion", gCurrentVersion); |
850 | 830 | ||
@@ -889,16 +869,21 @@ bool LLAppViewer::mainLoop() | |||
889 | { | 869 | { |
890 | LLFastTimer t(LLFastTimer::FTM_FRAME); | 870 | LLFastTimer t(LLFastTimer::FTM_FRAME); |
891 | 871 | ||
872 | pingMainloopTimeout("Main:MiscNativeWindowEvents"); | ||
873 | |||
874 | { | ||
875 | LLFastTimer t2(LLFastTimer::FTM_MESSAGES); | ||
876 | gViewerWindow->mWindow->processMiscNativeEvents(); | ||
877 | } | ||
878 | |||
892 | pingMainloopTimeout("Main:GatherInput"); | 879 | pingMainloopTimeout("Main:GatherInput"); |
893 | 880 | ||
894 | { | 881 | { |
895 | LLFastTimer t2(LLFastTimer::FTM_MESSAGES); | 882 | LLFastTimer t2(LLFastTimer::FTM_MESSAGES); |
896 | #if LL_WINDOWS | 883 | if (!restoreErrorTrap()) |
897 | if (!LLWinDebug::checkExceptionHandler()) | ||
898 | { | 884 | { |
899 | llwarns << " Someone took over my exception handler (post messagehandling)!" << llendl; | 885 | llwarns << " Someone took over my signal/exception handler (post messagehandling)!" << llendl; |
900 | } | 886 | } |
901 | #endif | ||
902 | 887 | ||
903 | gViewerWindow->mWindow->gatherInput(); | 888 | gViewerWindow->mWindow->gatherInput(); |
904 | } | 889 | } |
@@ -954,7 +939,7 @@ bool LLAppViewer::mainLoop() | |||
954 | 939 | ||
955 | resumeMainloopTimeout(); | 940 | resumeMainloopTimeout(); |
956 | } | 941 | } |
957 | 942 | ||
958 | if (gDoDisconnect && (LLStartUp::getStartupState() == STATE_STARTED)) | 943 | if (gDoDisconnect && (LLStartUp::getStartupState() == STATE_STARTED)) |
959 | { | 944 | { |
960 | pauseMainloopTimeout(); | 945 | pauseMainloopTimeout(); |
@@ -1365,12 +1350,15 @@ bool LLAppViewer::cleanup() | |||
1365 | delete sImageDecodeThread; | 1350 | delete sImageDecodeThread; |
1366 | sImageDecodeThread = NULL; | 1351 | sImageDecodeThread = NULL; |
1367 | 1352 | ||
1353 | //Note: | ||
1354 | //LLViewerMedia::cleanupClass() has to be put before gImageList.shutdown() | ||
1355 | //because some new image might be generated during cleaning up media. --bao | ||
1356 | LLViewerMedia::cleanupClass(); | ||
1368 | gImageList.shutdown(); // shutdown again in case a callback added something | 1357 | gImageList.shutdown(); // shutdown again in case a callback added something |
1369 | LLUIImageList::getInstance()->cleanUp(); | 1358 | LLUIImageList::getInstance()->cleanUp(); |
1370 | 1359 | ||
1371 | // This should eventually be done in LLAppViewer | 1360 | // This should eventually be done in LLAppViewer |
1372 | LLImageJ2C::closeDSO(); | 1361 | LLImage::cleanupClass(); |
1373 | LLImageFormatted::cleanupClass(); | ||
1374 | LLVFSThread::cleanupClass(); | 1362 | LLVFSThread::cleanupClass(); |
1375 | LLLFSThread::cleanupClass(); | 1363 | LLLFSThread::cleanupClass(); |
1376 | 1364 | ||
@@ -1409,8 +1397,6 @@ bool LLAppViewer::cleanup() | |||
1409 | 1397 | ||
1410 | LLWeb::loadURLExternal( gLaunchFileOnQuit ); | 1398 | LLWeb::loadURLExternal( gLaunchFileOnQuit ); |
1411 | } | 1399 | } |
1412 | |||
1413 | LLViewerMedia::cleanupClass(); | ||
1414 | 1400 | ||
1415 | llinfos << "Goodbye" << llendflush; | 1401 | llinfos << "Goodbye" << llendflush; |
1416 | 1402 | ||
@@ -1440,8 +1426,7 @@ bool LLAppViewer::initThreads() | |||
1440 | LLAppViewer::sImageDecodeThread = new LLWorkerThread("ImageDecode", enable_threads && true); | 1426 | LLAppViewer::sImageDecodeThread = new LLWorkerThread("ImageDecode", enable_threads && true); |
1441 | LLAppViewer::sTextureCache = new LLTextureCache(enable_threads && true); | 1427 | LLAppViewer::sTextureCache = new LLTextureCache(enable_threads && true); |
1442 | LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), enable_threads && false); | 1428 | LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), enable_threads && false); |
1443 | LLImageWorker::initClass(LLAppViewer::getImageDecodeThread()); | 1429 | LLImage::initClass(LLAppViewer::getImageDecodeThread()); |
1444 | LLImageJ2C::openDSO(); | ||
1445 | 1430 | ||
1446 | // *FIX: no error handling here! | 1431 | // *FIX: no error handling here! |
1447 | return true; | 1432 | return true; |
@@ -1878,22 +1863,6 @@ bool LLAppViewer::initConfiguration() | |||
1878 | // llerrs << "Failed to parse skin definition." << llendl; | 1863 | // llerrs << "Failed to parse skin definition." << llendl; |
1879 | // } | 1864 | // } |
1880 | 1865 | ||
1881 | // LLXmlTreeNode* rootp = skin_def_tree.getRoot(); | ||
1882 | // LLXmlTreeNode* disabled_message_node = rootp->getChildByName("disabled_message"); | ||
1883 | // if (disabled_message_node) | ||
1884 | // { | ||
1885 | // gDisabledMessage = disabled_message_node->getContents(); | ||
1886 | // } | ||
1887 | |||
1888 | // static LLStdStringHandle hide_links_string = LLXmlTree::addAttributeString("hide_links"); | ||
1889 | // rootp->getFastAttributeBOOL(hide_links_string, gHideLinks); | ||
1890 | |||
1891 | // // Legacy string. This flag really meant we didn't want to expose references to "Second Life". | ||
1892 | // // Just set gHideLinks instead. | ||
1893 | // static LLStdStringHandle silent_string = LLXmlTree::addAttributeString("silent_update"); | ||
1894 | // BOOL silent_update; | ||
1895 | // rootp->getFastAttributeBOOL(silent_string, silent_update); | ||
1896 | // gHideLinks = (gHideLinks || silent_update); | ||
1897 | //} | 1866 | //} |
1898 | 1867 | ||
1899 | #if LL_DARWIN | 1868 | #if LL_DARWIN |
@@ -1946,7 +1915,7 @@ bool LLAppViewer::initConfiguration() | |||
1946 | #endif | 1915 | #endif |
1947 | LLStringUtil::truncate(gWindowTitle, 255); | 1916 | LLStringUtil::truncate(gWindowTitle, 255); |
1948 | 1917 | ||
1949 | //RN: if we received a URL, hand it off to the existing instance | 1918 | //RN: if we received a URL, hand it off to the existing instance. |
1950 | // don't call anotherInstanceRunning() when doing URL handoff, as | 1919 | // don't call anotherInstanceRunning() when doing URL handoff, as |
1951 | // it relies on checking a marker file which will not work when running | 1920 | // it relies on checking a marker file which will not work when running |
1952 | // out of different directories | 1921 | // out of different directories |
@@ -1961,7 +1930,7 @@ bool LLAppViewer::initConfiguration() | |||
1961 | } | 1930 | } |
1962 | if (!slurl.empty()) | 1931 | if (!slurl.empty()) |
1963 | { | 1932 | { |
1964 | if (send_url_to_other_instance(slurl)) | 1933 | if (sendURLToOtherInstance(slurl)) |
1965 | { | 1934 | { |
1966 | // successfully handed off URL to existing instance, exit | 1935 | // successfully handed off URL to existing instance, exit |
1967 | return false; | 1936 | return false; |
@@ -1992,7 +1961,7 @@ bool LLAppViewer::initConfiguration() | |||
1992 | } | 1961 | } |
1993 | 1962 | ||
1994 | initMarkerFile(); | 1963 | initMarkerFile(); |
1995 | 1964 | ||
1996 | #if LL_SEND_CRASH_REPORTS | 1965 | #if LL_SEND_CRASH_REPORTS |
1997 | if (gLastExecEvent == LAST_EXEC_FROZE) | 1966 | if (gLastExecEvent == LAST_EXEC_FROZE) |
1998 | { | 1967 | { |
@@ -2014,52 +1983,8 @@ bool LLAppViewer::initConfiguration() | |||
2014 | { | 1983 | { |
2015 | llinfos << "Sending crash report." << llendl; | 1984 | llinfos << "Sending crash report." << llendl; |
2016 | 1985 | ||
2017 | #if LL_WINDOWS | 1986 | bool report_freeze = true; |
2018 | std::string exe_path = gDirUtilp->getAppRODataDir(); | 1987 | handleCrashReporting(report_freeze); |
2019 | exe_path += gDirUtilp->getDirDelimiter(); | ||
2020 | exe_path += "win_crash_logger.exe"; | ||
2021 | |||
2022 | std::string arg_string = "-previous "; | ||
2023 | // Spawn crash logger. | ||
2024 | // NEEDS to wait until completion, otherwise log files will get smashed. | ||
2025 | _spawnl(_P_WAIT, exe_path.c_str(), exe_path.c_str(), arg_string.c_str(), NULL); | ||
2026 | #elif LL_DARWIN | ||
2027 | std::string command_str; | ||
2028 | command_str = "mac-crash-logger.app/Contents/MacOS/mac-crash-logger "; | ||
2029 | command_str += "-previous"; | ||
2030 | // XXX -- We need to exit fullscreen mode for this to work. | ||
2031 | // XXX -- system() also doesn't wait for completion. Hmm... | ||
2032 | system(command_str.c_str()); /* Flawfinder: Ignore */ | ||
2033 | #elif LL_LINUX || LL_SOLARIS | ||
2034 | std::string cmd =gDirUtilp->getAppRODataDir(); | ||
2035 | cmd += gDirUtilp->getDirDelimiter(); | ||
2036 | #if LL_LINUX | ||
2037 | cmd += "linux-crash-logger.bin"; | ||
2038 | #else // LL_SOLARIS | ||
2039 | cmd += "bin/solaris-crash-logger"; | ||
2040 | #endif // LL_LINUX | ||
2041 | char* const cmdargv[] = | ||
2042 | {(char*)cmd.c_str(), | ||
2043 | (char*)"-previous", | ||
2044 | NULL}; | ||
2045 | fflush(NULL); // flush all buffers before the child inherits them | ||
2046 | pid_t pid = fork(); | ||
2047 | if (pid == 0) | ||
2048 | { // child | ||
2049 | execv(cmd.c_str(), cmdargv); /* Flawfinder: Ignore */ | ||
2050 | llwarns << "execv failure when trying to start " << cmd << llendl; | ||
2051 | _exit(1); // avoid atexit() | ||
2052 | } else { | ||
2053 | if (pid > 0) | ||
2054 | { | ||
2055 | // wait for child proc to die | ||
2056 | int childExitStatus; | ||
2057 | waitpid(pid, &childExitStatus, 0); | ||
2058 | } else { | ||
2059 | llwarns << "fork failure." << llendl; | ||
2060 | } | ||
2061 | } | ||
2062 | #endif | ||
2063 | } | 1988 | } |
2064 | else | 1989 | else |
2065 | { | 1990 | { |
@@ -2262,7 +2187,7 @@ void LLAppViewer::writeSystemInfo() | |||
2262 | gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB()); | 2187 | gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB()); |
2263 | gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated>>10); // MB -> KB | 2188 | gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated>>10); // MB -> KB |
2264 | gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple(); | 2189 | gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple(); |
2265 | 2190 | ||
2266 | // The user is not logged on yet, but record the current grid choice login url | 2191 | // The user is not logged on yet, but record the current grid choice login url |
2267 | // which may have been the intended grid. This can b | 2192 | // which may have been the intended grid. This can b |
2268 | gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel(); | 2193 | gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel(); |
@@ -2273,6 +2198,13 @@ void LLAppViewer::writeSystemInfo() | |||
2273 | gDebugInfo["MainloopThreadID"] = (S32)thread_id; | 2198 | gDebugInfo["MainloopThreadID"] = (S32)thread_id; |
2274 | #endif | 2199 | #endif |
2275 | 2200 | ||
2201 | // "CrashNotHandled" is set here, while things are running well, | ||
2202 | // in case of a freeze. If there is a freeze, the crash logger will be launched | ||
2203 | // and can read this value from the debug_info.log. | ||
2204 | // If the crash is handled by LLAppViewer::handleViewerCrash, ie not a freeze, | ||
2205 | // then the value of "CrashNotHandled" will be set to true. | ||
2206 | gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true; | ||
2207 | |||
2276 | // Dump some debugging info | 2208 | // Dump some debugging info |
2277 | LL_INFOS("SystemInfo") << gSecondLife | 2209 | LL_INFOS("SystemInfo") << gSecondLife |
2278 | << " version " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH | 2210 | << " version " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH |
@@ -2347,6 +2279,8 @@ void LLAppViewer::handleViewerCrash() | |||
2347 | gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); | 2279 | gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); |
2348 | gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName(); | 2280 | gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName(); |
2349 | gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath(); | 2281 | gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath(); |
2282 | gDebugInfo["SessionLength"] = F32(LLFrameTimer::getElapsedSeconds()); | ||
2283 | |||
2350 | if(gLogoutInProgress) | 2284 | if(gLogoutInProgress) |
2351 | { | 2285 | { |
2352 | gDebugInfo["LastExecEvent"] = LAST_EXEC_LOGOUT_CRASH; | 2286 | gDebugInfo["LastExecEvent"] = LAST_EXEC_LOGOUT_CRASH; |
@@ -2372,6 +2306,9 @@ void LLAppViewer::handleViewerCrash() | |||
2372 | gDebugInfo["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState(); | 2306 | gDebugInfo["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState(); |
2373 | } | 2307 | } |
2374 | 2308 | ||
2309 | // The crash is being handled here so set this value to false. | ||
2310 | // Otherwise the crash logger will think this crash was a freeze. | ||
2311 | gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)false; | ||
2375 | 2312 | ||
2376 | //Write out the crash status file | 2313 | //Write out the crash status file |
2377 | //Use marker file style setup, as that's the simplest, especially since | 2314 | //Use marker file style setup, as that's the simplest, especially since |
@@ -2455,24 +2392,23 @@ bool LLAppViewer::anotherInstanceRunning() | |||
2455 | { | 2392 | { |
2456 | // Another instance is running. Skip the rest of these operations. | 2393 | // Another instance is running. Skip the rest of these operations. |
2457 | LL_INFOS("MarkerFile") << "Marker file is locked." << LL_ENDL; | 2394 | LL_INFOS("MarkerFile") << "Marker file is locked." << LL_ENDL; |
2458 | return TRUE; | 2395 | return true; |
2459 | } | 2396 | } |
2460 | if (apr_file_lock(fMarker, APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE) != APR_SUCCESS) //flock(fileno(fMarker), LOCK_EX | LOCK_NB) == -1) | 2397 | if (apr_file_lock(fMarker, APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE) != APR_SUCCESS) //flock(fileno(fMarker), LOCK_EX | LOCK_NB) == -1) |
2461 | { | 2398 | { |
2462 | apr_file_close(fMarker); | 2399 | apr_file_close(fMarker); |
2463 | LL_INFOS("MarkerFile") << "Marker file is locked." << LL_ENDL; | 2400 | LL_INFOS("MarkerFile") << "Marker file is locked." << LL_ENDL; |
2464 | return TRUE; | 2401 | return true; |
2465 | } | 2402 | } |
2466 | // No other instances; we'll lock this file now & delete on quit. | 2403 | // No other instances; we'll lock this file now & delete on quit. |
2467 | apr_file_close(fMarker); | 2404 | apr_file_close(fMarker); |
2468 | } | 2405 | } |
2469 | LL_DEBUGS("MarkerFile") << "Marker file isn't locked." << LL_ENDL; | 2406 | LL_DEBUGS("MarkerFile") << "Marker file isn't locked." << LL_ENDL; |
2470 | return FALSE; | 2407 | return false; |
2471 | } | 2408 | } |
2472 | 2409 | ||
2473 | void LLAppViewer::initMarkerFile() | 2410 | void LLAppViewer::initMarkerFile() |
2474 | { | 2411 | { |
2475 | |||
2476 | //First, check for the existence of other files. | 2412 | //First, check for the existence of other files. |
2477 | //There are marker files for two different types of crashes | 2413 | //There are marker files for two different types of crashes |
2478 | 2414 | ||
@@ -2727,7 +2663,7 @@ bool LLAppViewer::initCache() | |||
2727 | 2663 | ||
2728 | // Init the texture cache | 2664 | // Init the texture cache |
2729 | // Allocate 80% of the cache size for textures | 2665 | // Allocate 80% of the cache size for textures |
2730 | BOOL read_only = mSecondInstance ? true : false; | 2666 | BOOL read_only = mSecondInstance ? TRUE : FALSE; |
2731 | const S32 MB = 1024*1024; | 2667 | const S32 MB = 1024*1024; |
2732 | S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB; | 2668 | S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB; |
2733 | const S64 MAX_CACHE_SIZE = 1024*MB; | 2669 | const S64 MAX_CACHE_SIZE = 1024*MB; |
@@ -3796,6 +3732,11 @@ void LLAppViewer::pauseMainloopTimeout() | |||
3796 | 3732 | ||
3797 | void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) | 3733 | void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) |
3798 | { | 3734 | { |
3735 | // if(!restoreErrorTrap()) | ||
3736 | // { | ||
3737 | // llwarns << "!!!!!!!!!!!!! Its an error trap!!!!" << state << llendl; | ||
3738 | // } | ||
3739 | |||
3799 | if(mMainloopTimeout) | 3740 | if(mMainloopTimeout) |
3800 | { | 3741 | { |
3801 | if(secs < 0.0f) | 3742 | if(secs < 0.0f) |
@@ -3808,3 +3749,42 @@ void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) | |||
3808 | } | 3749 | } |
3809 | } | 3750 | } |
3810 | 3751 | ||
3752 | void LLAppViewer::handleLoginComplete() | ||
3753 | { | ||
3754 | initMainloopTimeout("Mainloop Init"); | ||
3755 | |||
3756 | // Store some data to DebugInfo in case of a freeze. | ||
3757 | gDebugInfo["ClientInfo"]["Name"] = gSavedSettings.getString("VersionChannelName"); | ||
3758 | |||
3759 | gDebugInfo["ClientInfo"]["MajorVersion"] = LL_VERSION_MAJOR; | ||
3760 | gDebugInfo["ClientInfo"]["MinorVersion"] = LL_VERSION_MINOR; | ||
3761 | gDebugInfo["ClientInfo"]["PatchVersion"] = LL_VERSION_PATCH; | ||
3762 | gDebugInfo["ClientInfo"]["BuildVersion"] = LL_VERSION_BUILD; | ||
3763 | |||
3764 | LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); | ||
3765 | if ( parcel && parcel->getMusicURL()[0]) | ||
3766 | { | ||
3767 | gDebugInfo["ParcelMusicURL"] = parcel->getMusicURL(); | ||
3768 | } | ||
3769 | if ( parcel && parcel->getMediaURL()[0]) | ||
3770 | { | ||
3771 | gDebugInfo["ParcelMediaURL"] = parcel->getMediaURL(); | ||
3772 | } | ||
3773 | |||
3774 | gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile"); | ||
3775 | gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); | ||
3776 | gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName(); | ||
3777 | gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath(); | ||
3778 | |||
3779 | if(gAgent.getRegion()) | ||
3780 | { | ||
3781 | gDebugInfo["CurrentSimHost"] = gAgent.getRegionHost().getHostName(); | ||
3782 | gDebugInfo["CurrentRegion"] = gAgent.getRegion()->getName(); | ||
3783 | } | ||
3784 | |||
3785 | if(LLAppViewer::instance()->mMainloopTimeout) | ||
3786 | { | ||
3787 | gDebugInfo["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState(); | ||
3788 | } | ||
3789 | writeDebugInfo(); | ||
3790 | } | ||