diff options
Diffstat (limited to 'indra/newview/llappviewerwin32.cpp')
-rw-r--r-- | indra/newview/llappviewerwin32.cpp | 75 |
1 files changed, 45 insertions, 30 deletions
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index d9a0eb25e4..57fb84bbf1 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -29,11 +29,12 @@ #ifdef INCLUDE_VLD #include "vld.h" #endif +#include "llwin32headers.h" -#include "llappviewerwin32.h" +#include "llwindowwin32.h" // *FIX: for setting gIconResource. +#include "llappviewerwin32.h" -#include "llwindowwin32.h" // *FIX: for setting gIconResource. #include "llgl.h" #include "res/resource.h" // *FIX: for setting gIconResource. @@ -52,7 +53,6 @@ #include <stdlib.h> #include "llweb.h" -#include "llsecondlifeurls.h" #include "llviewernetwork.h" #include "llmd5.h" @@ -88,7 +88,7 @@ static void exceptionTerminateHandler() LONG WINAPI catchallCrashHandler(EXCEPTION_POINTERS * /*ExceptionInfo*/) { - llwarns << "Hit last ditch-effort attempt to catch crash." << llendl; + LL_WARNS() << "Hit last ditch-effort attempt to catch crash." << LL_ENDL; exceptionTerminateHandler(); return 0; } @@ -100,7 +100,7 @@ LONG WINAPI catchallCrashHandler(EXCEPTION_POINTERS * /*ExceptionInfo*/) extern "C" { void _wassert(const wchar_t * _Message, const wchar_t *_File, unsigned _Line) { - llerrs << _Message << llendl; + LL_ERRS() << _Message << LL_ENDL; } } #endif @@ -116,7 +116,7 @@ void nvapi_error(NvAPI_Status status) { NvAPI_ShortString szDesc = {0}; NvAPI_GetErrorMessage(status, szDesc); - llwarns << szDesc << llendl; + LL_WARNS() << szDesc << LL_ENDL; //should always trigger when asserts are enabled //llassert(status == NVAPI_OK); @@ -278,7 +278,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, bool ok = viewer_app_ptr->init(); if(!ok) { - llwarns << "Application init failed." << llendl; + LL_WARNS() << "Application init failed." << LL_ENDL; return -1; } @@ -306,12 +306,12 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // Have to wait until after logging is initialized to display LFH info if (num_heaps > 0) { - llinfos << "Attempted to enable LFH for " << num_heaps << " heaps." << llendl; + LL_INFOS() << "Attempted to enable LFH for " << num_heaps << " heaps." << LL_ENDL; for(S32 i = 0; i < num_heaps; i++) { if (heap_enable_lfh_error[i]) { - llinfos << " Failed to enable LFH for heap: " << i << " Error: " << heap_enable_lfh_error[i] << llendl; + LL_INFOS() << " Failed to enable LFH for heap: " << i << " Error: " << heap_enable_lfh_error[i] << LL_ENDL; } } } @@ -330,14 +330,14 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // app cleanup if there was a problem. // #if WINDOWS_CRT_MEM_CHECKS - llinfos << "CRT Checking memory:" << llendflush; + LL_INFOS() << "CRT Checking memory:" << LL_ENDL; if (!_CrtCheckMemory()) { - llwarns << "_CrtCheckMemory() failed at prior to cleanup!" << llendflush; + LL_WARNS() << "_CrtCheckMemory() failed at prior to cleanup!" << LL_ENDL; } else { - llinfos << " No corruption detected." << llendflush; + LL_INFOS() << " No corruption detected." << LL_ENDL; } #endif @@ -346,14 +346,14 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, viewer_app_ptr->cleanup(); #if WINDOWS_CRT_MEM_CHECKS - llinfos << "CRT Checking memory:" << llendflush; + LL_INFOS() << "CRT Checking memory:" << LL_ENDL; if (!_CrtCheckMemory()) { - llwarns << "_CrtCheckMemory() failed after cleanup!" << llendflush; + LL_WARNS() << "_CrtCheckMemory() failed after cleanup!" << LL_ENDL; } else { - llinfos << " No corruption detected." << llendflush; + LL_INFOS() << " No corruption detected." << LL_ENDL; } #endif @@ -424,11 +424,11 @@ void LLAppViewerWin32::disableWinErrorReporting() if( 0 == pAddERExcludedApplicationA( executable_name ) ) { U32 error_code = GetLastError(); - llinfos << "AddERExcludedApplication() failed with error code " << error_code << llendl; + LL_INFOS() << "AddERExcludedApplication() failed with error code " << error_code << LL_ENDL; } else { - llinfos << "AddERExcludedApplication() success for " << executable_name << llendl; + LL_INFOS() << "AddERExcludedApplication() success for " << executable_name << LL_ENDL; } } FreeLibrary( fault_rep_dll_handle ); @@ -438,7 +438,7 @@ void LLAppViewerWin32::disableWinErrorReporting() const S32 MAX_CONSOLE_LINES = 500; -void create_console() +static bool create_console() { int h_con_handle; long l_std_handle; @@ -447,7 +447,7 @@ void create_console() FILE *fp; // allocate a console for this app - AllocConsole(); + const bool isConsoleAllocated = AllocConsole(); // set the screen buffer to be big enough to let us scroll text GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo); @@ -459,7 +459,7 @@ void create_console() h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); if (h_con_handle == -1) { - llwarns << "create_console() failed to open stdout handle" << llendl; + LL_WARNS() << "create_console() failed to open stdout handle" << LL_ENDL; } else { @@ -473,7 +473,7 @@ void create_console() h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); if (h_con_handle == -1) { - llwarns << "create_console() failed to open stdin handle" << llendl; + LL_WARNS() << "create_console() failed to open stdin handle" << LL_ENDL; } else { @@ -487,7 +487,7 @@ void create_console() h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); if (h_con_handle == -1) { - llwarns << "create_console() failed to open stderr handle" << llendl; + LL_WARNS() << "create_console() failed to open stderr handle" << LL_ENDL; } else { @@ -495,10 +495,13 @@ void create_console() *stderr = *fp; setvbuf( stderr, NULL, _IONBF, 0 ); } + + return isConsoleAllocated; } LLAppViewerWin32::LLAppViewerWin32(const char* cmd_line) : - mCmdLine(cmd_line) + mCmdLine(cmd_line), + mIsConsoleAllocated(false) { } @@ -514,7 +517,7 @@ bool LLAppViewerWin32::init() // (Don't send our data to Microsoft--at least until we are Logo approved and have a way // of getting the data back from them.) // - // llinfos << "Turning off Windows error reporting." << llendl; + // LL_INFOS() << "Turning off Windows error reporting." << LL_ENDL; disableWinErrorReporting(); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -542,6 +545,16 @@ bool LLAppViewerWin32::cleanup() gDXHardware.cleanup(); +#ifndef LL_RELEASE_FOR_DOWNLOAD + LLWinDebug::instance().cleanup(); +#endif + + if (mIsConsoleAllocated) + { + FreeConsole(); + mIsConsoleAllocated = false; + } + return result; } @@ -553,7 +566,7 @@ void LLAppViewerWin32::initLoggingAndGetLastDuration() void LLAppViewerWin32::initConsole() { // pop up debug console - create_console(); + mIsConsoleAllocated = create_console(); return LLAppViewer::initConsole(); } @@ -603,7 +616,7 @@ bool LLAppViewerWin32::initHardwareTest() if (OSBTN_NO== button) { LL_INFOS("AppInit") << "User quitting after failed DirectX 9 detection" << LL_ENDL; - LLWeb::loadURLExternal(DIRECTX_9_URL, false); + LLWeb::loadURLExternal("http://secondlife.com/support/", false); return false; } gWarningSettings.setBOOL("AboutDirectX9", FALSE); @@ -674,6 +687,8 @@ bool LLAppViewerWin32::restoreErrorTrap() void LLAppViewerWin32::initCrashReporting(bool reportFreeze) { + if (isSecondInstance()) return; //BUG-5707 do not start another crash reporter for second instance. + const char* logger_name = "win_crash_logger.exe"; std::string exe_path = gDirUtilp->getExecutableDir(); exe_path += gDirUtilp->getDirDelimiter(); @@ -732,7 +747,7 @@ bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) if (other_window != NULL) { - lldebugs << "Found other window with the name '" << getWindowTitle() << "'" << llendl; + LL_DEBUGS() << "Found other window with the name '" << getWindowTitle() << "'" << LL_ENDL; COPYDATASTRUCT cds; const S32 SLURL_MESSAGE_TYPE = 0; cds.dwData = SLURL_MESSAGE_TYPE; @@ -740,8 +755,8 @@ bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) cds.lpData = (void*)url.c_str(); LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); - lldebugs << "SendMessage(WM_COPYDATA) to other window '" - << getWindowTitle() << "' returned " << msg_result << llendl; + LL_DEBUGS() << "SendMessage(WM_COPYDATA) to other window '" + << getWindowTitle() << "' returned " << msg_result << LL_ENDL; return true; } return false; @@ -773,7 +788,7 @@ std::string LLAppViewerWin32::generateSerialNumber() } else { - llwarns << "GetVolumeInformation failed" << llendl; + LL_WARNS() << "GetVolumeInformation failed" << LL_ENDL; } return serial_md5; } |