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/llappviewerwin32.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 'linden/indra/newview/llappviewerwin32.cpp')
-rw-r--r-- | linden/indra/newview/llappviewerwin32.cpp | 104 |
1 files changed, 80 insertions, 24 deletions
diff --git a/linden/indra/newview/llappviewerwin32.cpp b/linden/indra/newview/llappviewerwin32.cpp index 9f37534..bf02087 100644 --- a/linden/indra/newview/llappviewerwin32.cpp +++ b/linden/indra/newview/llappviewerwin32.cpp | |||
@@ -64,7 +64,7 @@ | |||
64 | 64 | ||
65 | #include "llcommandlineparser.h" | 65 | #include "llcommandlineparser.h" |
66 | 66 | ||
67 | //*FIX:Mani - This hack is to fix a linker issue with libndofdev.lib | 67 | // *FIX:Mani - This hack is to fix a linker issue with libndofdev.lib |
68 | // The lib was compiled under VS2005 - in VS2003 we need to remap assert | 68 | // The lib was compiled under VS2005 - in VS2003 we need to remap assert |
69 | #ifdef LL_DEBUG | 69 | #ifdef LL_DEBUG |
70 | #ifdef LL_MSVC7 | 70 | #ifdef LL_MSVC7 |
@@ -77,6 +77,8 @@ extern "C" { | |||
77 | #endif | 77 | #endif |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | const std::string LLAppViewerWin32::sWindowClass = "Second Life"; | ||
81 | |||
80 | LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop) | 82 | LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop) |
81 | { | 83 | { |
82 | // *NOTE:Mani - this code is stolen from LLApp, where its never actually used. | 84 | // *NOTE:Mani - this code is stolen from LLApp, where its never actually used. |
@@ -91,6 +93,7 @@ LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *excepti | |||
91 | if (LLApp::isError()) | 93 | if (LLApp::isError()) |
92 | { | 94 | { |
93 | llwarns << "Got another fatal signal while in the error handler, die now!" << llendl; | 95 | llwarns << "Got another fatal signal while in the error handler, die now!" << llendl; |
96 | |||
94 | retval = EXCEPTION_EXECUTE_HANDLER; | 97 | retval = EXCEPTION_EXECUTE_HANDLER; |
95 | return retval; | 98 | return retval; |
96 | } | 99 | } |
@@ -119,7 +122,6 @@ LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *excepti | |||
119 | return retval; | 122 | return retval; |
120 | } | 123 | } |
121 | 124 | ||
122 | |||
123 | #if DEBUGGING_SEH_FILTER | 125 | #if DEBUGGING_SEH_FILTER |
124 | # define WINMAIN DebuggingWinMain | 126 | # define WINMAIN DebuggingWinMain |
125 | #else | 127 | #else |
@@ -195,6 +197,19 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, | |||
195 | } | 197 | } |
196 | delete viewer_app_ptr; | 198 | delete viewer_app_ptr; |
197 | viewer_app_ptr = NULL; | 199 | viewer_app_ptr = NULL; |
200 | |||
201 | //start updater | ||
202 | if(LLAppViewer::sUpdaterInfo) | ||
203 | { | ||
204 | #if LL_WINDOWS | ||
205 | _spawnl(_P_NOWAIT, LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), LLAppViewer::sUpdaterInfo->mParams.str().c_str(), NULL); | ||
206 | #elif LL_DARWIN | ||
207 | system(LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str()); /* Flawfinder: ignore */ | ||
208 | #endif | ||
209 | delete LLAppViewer::sUpdaterInfo ; | ||
210 | LLAppViewer::sUpdaterInfo = NULL ; | ||
211 | } | ||
212 | |||
198 | return 0; | 213 | return 0; |
199 | } | 214 | } |
200 | 215 | ||
@@ -324,6 +339,17 @@ bool LLAppViewerWin32::cleanup() | |||
324 | return result; | 339 | return result; |
325 | } | 340 | } |
326 | 341 | ||
342 | bool LLAppViewerWin32::initLogging() | ||
343 | { | ||
344 | // Remove the crash stack log from previous executions. | ||
345 | // Since we've started logging a new instance of the app, we can assume | ||
346 | // *NOTE: This should happen before the we send a 'previous instance froze' | ||
347 | // crash report, but it must happen after we initialize the DirUtil. | ||
348 | LLWinDebug::clearCrashStacks(); | ||
349 | |||
350 | return LLAppViewer::initLogging(); | ||
351 | } | ||
352 | |||
327 | void LLAppViewerWin32::initConsole() | 353 | void LLAppViewerWin32::initConsole() |
328 | { | 354 | { |
329 | // pop up debug console | 355 | // pop up debug console |
@@ -405,7 +431,7 @@ bool LLAppViewerWin32::initHardwareTest() | |||
405 | LLSplashScreen::update(splash_msg.str()); | 431 | LLSplashScreen::update(splash_msg.str()); |
406 | } | 432 | } |
407 | 433 | ||
408 | if (!LLWinDebug::checkExceptionHandler()) | 434 | if (!restoreErrorTrap()) |
409 | { | 435 | { |
410 | LL_WARNS("AppInit") << " Someone took over my exception handler (post hardware probe)!" << LL_ENDL; | 436 | LL_WARNS("AppInit") << " Someone took over my exception handler (post hardware probe)!" << LL_ENDL; |
411 | } | 437 | } |
@@ -445,39 +471,69 @@ bool LLAppViewerWin32::initParseCommandLine(LLCommandLineParser& clp) | |||
445 | return true; | 471 | return true; |
446 | } | 472 | } |
447 | 473 | ||
474 | bool LLAppViewerWin32::restoreErrorTrap() | ||
475 | { | ||
476 | return LLWinDebug::checkExceptionHandler(); | ||
477 | } | ||
478 | |||
448 | void LLAppViewerWin32::handleSyncCrashTrace() | 479 | void LLAppViewerWin32::handleSyncCrashTrace() |
449 | { | 480 | { |
450 | // do nothing | 481 | // do nothing |
451 | } | 482 | } |
452 | 483 | ||
453 | void LLAppViewerWin32::handleCrashReporting() | 484 | void LLAppViewerWin32::handleCrashReporting(bool reportFreeze) |
454 | { | 485 | { |
455 | // Windows only behaivor. Spawn win crash reporter. | 486 | const char* logger_name = "win_crash_logger.exe"; |
456 | std::string exe_path = gDirUtilp->getAppRODataDir(); | 487 | std::string exe_path = gDirUtilp->getExecutableDir(); |
457 | exe_path += gDirUtilp->getDirDelimiter(); | 488 | exe_path += gDirUtilp->getDirDelimiter(); |
458 | exe_path += "win_crash_logger.exe"; | 489 | exe_path += logger_name; |
459 | 490 | ||
460 | std::string arg_string = "-user "; | 491 | const char* arg_str = logger_name; |
461 | arg_string += LLViewerLogin::getInstance()->getGridLabel(); | 492 | |
462 | 493 | // *NOTE:Mani - win_crash_logger.exe no longer parses command line options. | |
463 | S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); | 494 | if(reportFreeze) |
464 | switch(cb) | 495 | { |
496 | // Spawn crash logger. | ||
497 | // NEEDS to wait until completion, otherwise log files will get smashed. | ||
498 | _spawnl(_P_WAIT, exe_path.c_str(), arg_str, NULL); | ||
499 | } | ||
500 | else | ||
501 | { | ||
502 | S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); | ||
503 | if(cb != CRASH_BEHAVIOR_NEVER_SEND) | ||
504 | { | ||
505 | _spawnl(_P_NOWAIT, exe_path.c_str(), arg_str, NULL); | ||
506 | } | ||
507 | } | ||
508 | } | ||
509 | |||
510 | //virtual | ||
511 | bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) | ||
512 | { | ||
513 | wchar_t window_class[256]; /* Flawfinder: ignore */ // Assume max length < 255 chars. | ||
514 | mbstowcs(window_class, sWindowClass.c_str(), 255); | ||
515 | window_class[255] = 0; | ||
516 | // Use the class instead of the window name. | ||
517 | HWND other_window = FindWindow(window_class, NULL); | ||
518 | |||
519 | if (other_window != NULL) | ||
465 | { | 520 | { |
466 | case CRASH_BEHAVIOR_ASK: | 521 | lldebugs << "Found other window with the name '" << getWindowTitle() << "'" << llendl; |
467 | default: | 522 | COPYDATASTRUCT cds; |
468 | arg_string += " -dialog "; | 523 | const S32 SLURL_MESSAGE_TYPE = 0; |
469 | _spawnl(_P_NOWAIT, exe_path.c_str(), exe_path.c_str(), arg_string.c_str(), NULL); | 524 | cds.dwData = SLURL_MESSAGE_TYPE; |
470 | break; | 525 | cds.cbData = url.length() + 1; |
471 | 526 | cds.lpData = (void*)url.c_str(); | |
472 | case CRASH_BEHAVIOR_ALWAYS_SEND: | 527 | |
473 | _spawnl(_P_NOWAIT, exe_path.c_str(), exe_path.c_str(), arg_string.c_str(), NULL); | 528 | LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); |
474 | break; | 529 | lldebugs << "SendMessage(WM_COPYDATA) to other window '" |
475 | 530 | << getWindowTitle() << "' returned " << msg_result << llendl; | |
476 | case CRASH_BEHAVIOR_NEVER_SEND: | 531 | return true; |
477 | break; | ||
478 | } | 532 | } |
533 | return false; | ||
479 | } | 534 | } |
480 | 535 | ||
536 | |||
481 | std::string LLAppViewerWin32::generateSerialNumber() | 537 | std::string LLAppViewerWin32::generateSerialNumber() |
482 | { | 538 | { |
483 | char serial_md5[MD5HEX_STR_SIZE]; // Flawfinder: ignore | 539 | char serial_md5[MD5HEX_STR_SIZE]; // Flawfinder: ignore |