aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llappviewer.cpp92
1 files changed, 82 insertions, 10 deletions
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp
index 5baf7b6..5573633 100644
--- a/linden/indra/newview/llappviewer.cpp
+++ b/linden/indra/newview/llappviewer.cpp
@@ -324,7 +324,7 @@ BOOL gPeriodicSlowFrame = FALSE;
324 324
325BOOL gQAMode = FALSE; 325BOOL gQAMode = FALSE;
326BOOL gLLErrorActivated = FALSE; 326BOOL gLLErrorActivated = FALSE;
327 327BOOL gLogoutInProgress = FALSE;
328//////////////////////////////////////////////////////////// 328////////////////////////////////////////////////////////////
329// Internal globals... that should be removed. 329// Internal globals... that should be removed.
330static F32 gQuitAfterSeconds = 0.f; 330static F32 gQuitAfterSeconds = 0.f;
@@ -348,6 +348,7 @@ static const char* LEGACY_DEFAULT_SETTINGS_FILE = "settings.ini";
348const char* MARKER_FILE_NAME = "SecondLife.exec_marker"; 348const char* MARKER_FILE_NAME = "SecondLife.exec_marker";
349const char* ERROR_MARKER_FILE_NAME = "SecondLife.error_marker"; 349const char* ERROR_MARKER_FILE_NAME = "SecondLife.error_marker";
350const char* LLERROR_MARKER_FILE_NAME = "SecondLife.llerror_marker"; 350const char* LLERROR_MARKER_FILE_NAME = "SecondLife.llerror_marker";
351const char* LOGOUT_MARKER_FILE_NAME = "SecondLife.logout_marker";
351static BOOL gDoDisconnect = FALSE; 352static BOOL gDoDisconnect = FALSE;
352static LLString gLaunchFileOnQuit; 353static LLString gLaunchFileOnQuit;
353 354
@@ -884,7 +885,14 @@ int parse_args(int argc, char **argv)
884#endif 885#endif
885 else if(!strncmp(argv[j], "-qa", 3)) 886 else if(!strncmp(argv[j], "-qa", 3))
886 { 887 {
888 // This whole case should disappear with settings clean-up work in QAR-369
889 // or at least be replaced by setting a boolean in the settings repository. -MG
887 gQAMode = TRUE; 890 gQAMode = TRUE;
891 LLUI::setQAMode(gQAMode);
892 }
893 else if(argument == "-crash")
894 {
895 LLAppViewer::instance()->forceErrorBadMemoryAccess();
888 } 896 }
889 else 897 else
890 { 898 {
@@ -1359,9 +1367,10 @@ bool LLAppViewer::mainLoop()
1359 while (!LLApp::isExiting()) 1367 while (!LLApp::isExiting())
1360 { 1368 {
1361 LLFastTimer::reset(); // Should be outside of any timer instances 1369 LLFastTimer::reset(); // Should be outside of any timer instances
1370 try
1362 { 1371 {
1363 LLFastTimer t(LLFastTimer::FTM_FRAME); 1372 LLFastTimer t(LLFastTimer::FTM_FRAME);
1364 1373
1365 { 1374 {
1366 LLFastTimer t2(LLFastTimer::FTM_MESSAGES); 1375 LLFastTimer t2(LLFastTimer::FTM_MESSAGES);
1367 #if LL_WINDOWS 1376 #if LL_WINDOWS
@@ -1523,12 +1532,23 @@ bool LLAppViewer::mainLoop()
1523 } 1532 }
1524 1533
1525 } 1534 }
1535 catch(std::bad_alloc)
1536 {
1537 llwarns << "Bad memory allocation in LLAppViewer::mainLoop()!" << llendl ;
1538 }
1526 } 1539 }
1527 1540
1528 // Save snapshot for next time, if we made it through initialization 1541 // Save snapshot for next time, if we made it through initialization
1529 if (STATE_STARTED == LLStartUp::getStartupState()) 1542 if (STATE_STARTED == LLStartUp::getStartupState())
1530 { 1543 {
1531 saveFinalSnapshot(); 1544 try
1545 {
1546 saveFinalSnapshot();
1547 }
1548 catch(std::bad_alloc)
1549 {
1550 llwarns << "Bad memory allocation when saveFinalSnapshot() is called!" << llendl ;
1551 }
1532 } 1552 }
1533 1553
1534 delete gServicePump; 1554 delete gServicePump;
@@ -2492,6 +2512,7 @@ void LLAppViewer::writeSystemInfo()
2492 gDebugInfo["ClientInfo"]["PatchVersion"] = LL_VERSION_PATCH; 2512 gDebugInfo["ClientInfo"]["PatchVersion"] = LL_VERSION_PATCH;
2493 gDebugInfo["ClientInfo"]["BuildVersion"] = LL_VERSION_BUILD; 2513 gDebugInfo["ClientInfo"]["BuildVersion"] = LL_VERSION_BUILD;
2494 2514
2515 gDebugInfo["CPUInfo"]["CPUString"] = gSysCPU.getCPUString();
2495 gDebugInfo["CPUInfo"]["CPUFamily"] = gSysCPU.getFamily(); 2516 gDebugInfo["CPUInfo"]["CPUFamily"] = gSysCPU.getFamily();
2496 gDebugInfo["CPUInfo"]["CPUMhz"] = gSysCPU.getMhz(); 2517 gDebugInfo["CPUInfo"]["CPUMhz"] = gSysCPU.getMhz();
2497 gDebugInfo["CPUInfo"]["CPUAltivec"] = gSysCPU.hasAltivec(); 2518 gDebugInfo["CPUInfo"]["CPUAltivec"] = gSysCPU.hasAltivec();
@@ -2541,7 +2562,20 @@ void LLAppViewer::handleViewerCrash()
2541 gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); 2562 gDebugInfo["CAFilename"] = gDirUtilp->getCAFile();
2542 gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName().c_str(); 2563 gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName().c_str();
2543 gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath().c_str(); 2564 gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath().c_str();
2544 gDebugInfo["CurrentSimHost"] = gAgent.getRegionHost().getHostName(); 2565 if(gLogoutInProgress)
2566 {
2567 gDebugInfo["LastExecEvent"] = LAST_EXEC_LOGOUT_CRASH;
2568 }
2569 else
2570 {
2571 gDebugInfo["LastExecEvent"] = gLLErrorActivated ? LAST_EXEC_LLERROR_CRASH : LAST_EXEC_OTHER_CRASH;
2572 }
2573
2574 if(gAgent.getRegion())
2575 {
2576 gDebugInfo["CurrentSimHost"] = gAgent.getRegionHost().getHostName();
2577 gDebugInfo["CurrentRegion"] = gAgent.getRegion()->getName();
2578 }
2545 2579
2546 //Write out the crash status file 2580 //Write out the crash status file
2547 //Use marker file style setup, as that's the simplest, especially since 2581 //Use marker file style setup, as that's the simplest, especially since
@@ -2591,7 +2625,14 @@ void LLAppViewer::handleViewerCrash()
2591 LLError::logToFile(""); 2625 LLError::logToFile("");
2592 2626
2593 // Remove the marker file, since otherwise we'll spawn a process that'll keep it locked 2627 // Remove the marker file, since otherwise we'll spawn a process that'll keep it locked
2594 pApp->removeMarkerFile(); 2628 if(gDebugInfo["LastExecEvent"].asInteger() == LAST_EXEC_LOGOUT_CRASH)
2629 {
2630 pApp->removeMarkerFile(true);
2631 }
2632 else
2633 {
2634 pApp->removeMarkerFile(false);
2635 }
2595 2636
2596 // Call to pure virtual, handled by platform specifc llappviewer instance. 2637 // Call to pure virtual, handled by platform specifc llappviewer instance.
2597 pApp->handleCrashReporting(); 2638 pApp->handleCrashReporting();
@@ -2656,24 +2697,35 @@ void LLAppViewer::initMarkerFile()
2656 // These checks should also remove these files for the last 2 cases if they currently exist 2697 // These checks should also remove these files for the last 2 cases if they currently exist
2657 2698
2658 //LLError/Error checks. Only one of these should ever happen at a time. 2699 //LLError/Error checks. Only one of these should ever happen at a time.
2700 LLString logout_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LOGOUT_MARKER_FILE_NAME);
2659 LLString llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME); 2701 LLString llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME);
2660 LLString error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME); 2702 LLString error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME);
2661 apr_file_t* fMarker = ll_apr_file_open(llerror_marker_file, LL_APR_RB); 2703
2704 apr_file_t* fMarker = ll_apr_file_open(logout_marker_file, LL_APR_RB);
2705 if(fMarker != NULL)
2706 {
2707 apr_file_close(fMarker);
2708 llinfos << "Last exec LLError crashed, setting LastExecEvent to " << LAST_EXEC_LLERROR_CRASH << llendl;
2709 gLastExecEvent = LAST_EXEC_LOGOUT_FROZE;
2710 }
2711 fMarker = ll_apr_file_open(llerror_marker_file, LL_APR_RB);
2662 if(fMarker != NULL) 2712 if(fMarker != NULL)
2663 { 2713 {
2664 apr_file_close(fMarker); 2714 apr_file_close(fMarker);
2665 llinfos << "Last exec LLError crashed, setting LastExecEvent to " << LAST_EXEC_LLERROR_CRASH << llendl; 2715 llinfos << "Last exec LLError crashed, setting LastExecEvent to " << LAST_EXEC_LLERROR_CRASH << llendl;
2666 gLastExecEvent = LAST_EXEC_LLERROR_CRASH; 2716 if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
2717 else gLastExecEvent = LAST_EXEC_LLERROR_CRASH;
2667 } 2718 }
2668
2669 fMarker = ll_apr_file_open(error_marker_file, LL_APR_RB); 2719 fMarker = ll_apr_file_open(error_marker_file, LL_APR_RB);
2670 if(fMarker != NULL) 2720 if(fMarker != NULL)
2671 { 2721 {
2672 apr_file_close(fMarker); 2722 apr_file_close(fMarker);
2673 llinfos << "Last exec crashed, setting LastExecEvent to " << LAST_EXEC_OTHER_CRASH << llendl; 2723 llinfos << "Last exec crashed, setting LastExecEvent to " << LAST_EXEC_OTHER_CRASH << llendl;
2674 gLastExecEvent = LAST_EXEC_OTHER_CRASH; 2724 if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
2725 else gLastExecEvent = LAST_EXEC_OTHER_CRASH;
2675 } 2726 }
2676 2727
2728 ll_apr_file_remove(logout_marker_file);
2677 ll_apr_file_remove(llerror_marker_file); 2729 ll_apr_file_remove(llerror_marker_file);
2678 ll_apr_file_remove(error_marker_file); 2730 ll_apr_file_remove(error_marker_file);
2679 2731
@@ -2696,6 +2748,7 @@ void LLAppViewer::initMarkerFile()
2696 else 2748 else
2697 { 2749 {
2698 llinfos << "Failed to create marker file." << llendl; 2750 llinfos << "Failed to create marker file." << llendl;
2751 return;
2699 } 2752 }
2700 if (apr_file_lock(mMarkerFile, APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE) != APR_SUCCESS) 2753 if (apr_file_lock(mMarkerFile, APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE) != APR_SUCCESS)
2701 { 2754 {
@@ -2708,7 +2761,7 @@ void LLAppViewer::initMarkerFile()
2708 llinfos << "Exiting initMarkerFile()." << llendl; 2761 llinfos << "Exiting initMarkerFile()." << llendl;
2709} 2762}
2710 2763
2711void LLAppViewer::removeMarkerFile() 2764void LLAppViewer::removeMarkerFile(bool leave_logout_marker)
2712{ 2765{
2713 llinfos << "removeMarkerFile()" << llendl; 2766 llinfos << "removeMarkerFile()" << llendl;
2714 if (mMarkerFile != NULL) 2767 if (mMarkerFile != NULL)
@@ -2716,6 +2769,11 @@ void LLAppViewer::removeMarkerFile()
2716 ll_apr_file_remove( mMarkerFileName ); 2769 ll_apr_file_remove( mMarkerFileName );
2717 mMarkerFile = NULL; 2770 mMarkerFile = NULL;
2718 } 2771 }
2772 if (mLogoutMarkerFile != NULL && !leave_logout_marker)
2773 {
2774 ll_apr_file_remove( mLogoutMarkerFileName );
2775 mLogoutMarkerFile = NULL;
2776 }
2719} 2777}
2720 2778
2721void LLAppViewer::forceQuit() 2779void LLAppViewer::forceQuit()
@@ -3731,6 +3789,20 @@ void LLAppViewer::sendLogoutRequest()
3731 mLogoutRequestSent = TRUE; 3789 mLogoutRequestSent = TRUE;
3732 3790
3733 gVoiceClient->leaveChannel(); 3791 gVoiceClient->leaveChannel();
3792
3793 //Set internal status variables and marker files
3794 gLogoutInProgress = TRUE;
3795 mLogoutMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LOGOUT_MARKER_FILE_NAME);
3796 mLogoutMarkerFile = ll_apr_file_open(mLogoutMarkerFileName, LL_APR_W);
3797 if (mLogoutMarkerFile)
3798 {
3799 llinfos << "Created logout marker file " << mLogoutMarkerFileName << llendl;
3800 }
3801 else
3802 {
3803 llwarns << "Cannot create logout marker file " << mLogoutMarkerFileName << llendl;
3804 }
3805 apr_file_close(mLogoutMarkerFile);
3734 } 3806 }
3735} 3807}
3736 3808