diff options
Diffstat (limited to 'linden/indra/newview/llappviewerwin32.cpp')
-rw-r--r-- | linden/indra/newview/llappviewerwin32.cpp | 62 |
1 files changed, 49 insertions, 13 deletions
diff --git a/linden/indra/newview/llappviewerwin32.cpp b/linden/indra/newview/llappviewerwin32.cpp index e90887e..07f3ece 100644 --- a/linden/indra/newview/llappviewerwin32.cpp +++ b/linden/indra/newview/llappviewerwin32.cpp | |||
@@ -31,6 +31,10 @@ | |||
31 | 31 | ||
32 | #include "llviewerprecompiledheaders.h" | 32 | #include "llviewerprecompiledheaders.h" |
33 | 33 | ||
34 | #if defined(_DEBUG) | ||
35 | # define WINDOWS_CRT_MEM_CHECKS 1 | ||
36 | #endif | ||
37 | |||
34 | #include "llappviewerwin32.h" | 38 | #include "llappviewerwin32.h" |
35 | 39 | ||
36 | #include "llmemtype.h" | 40 | #include "llmemtype.h" |
@@ -61,14 +65,14 @@ | |||
61 | //*FIX:Mani - This hack is to fix a linker issue with libndofdev.lib | 65 | //*FIX:Mani - This hack is to fix a linker issue with libndofdev.lib |
62 | // The lib was compiled under VS2005 - in VS2003 we need to remap assert | 66 | // The lib was compiled under VS2005 - in VS2003 we need to remap assert |
63 | #ifdef LL_DEBUG | 67 | #ifdef LL_DEBUG |
64 | #if (_MSC_VER < 1400) | 68 | #ifdef LL_MSVC7 |
65 | extern "C" { | 69 | extern "C" { |
66 | void _wassert(const wchar_t * _Message, const wchar_t *_File, unsigned _Line) | 70 | void _wassert(const wchar_t * _Message, const wchar_t *_File, unsigned _Line) |
67 | { | 71 | { |
68 | llerrs << _Message << llendl; | 72 | llerrs << _Message << llendl; |
69 | } | 73 | } |
70 | } | 74 | } |
71 | #endif | 75 | #endif |
72 | #endif | 76 | #endif |
73 | 77 | ||
74 | LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop) | 78 | LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop) |
@@ -127,6 +131,10 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, | |||
127 | { | 131 | { |
128 | LLMemType mt1(LLMemType::MTYPE_STARTUP); | 132 | LLMemType mt1(LLMemType::MTYPE_STARTUP); |
129 | 133 | ||
134 | #if WINDOWS_CRT_MEM_CHECKS && !INCLUDE_VLD | ||
135 | _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump memory leaks on exit | ||
136 | #endif | ||
137 | |||
130 | // *FIX: global | 138 | // *FIX: global |
131 | gIconResource = MAKEINTRESOURCE(IDI_LL_ICON); | 139 | gIconResource = MAKEINTRESOURCE(IDI_LL_ICON); |
132 | 140 | ||
@@ -156,7 +164,32 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, | |||
156 | // the assumption is that the error handler is responsible for doing | 164 | // the assumption is that the error handler is responsible for doing |
157 | // app cleanup if there was a problem. | 165 | // app cleanup if there was a problem. |
158 | // | 166 | // |
159 | viewer_app_ptr->cleanup(); | 167 | #if WINDOWS_CRT_MEM_CHECKS |
168 | llinfos << "CRT Checking memory:" << llendflush; | ||
169 | if (!_CrtCheckMemory()) | ||
170 | { | ||
171 | llwarns << "_CrtCheckMemory() failed at prior to cleanup!" << llendflush; | ||
172 | } | ||
173 | else | ||
174 | { | ||
175 | llinfos << " No corruption detected." << llendflush; | ||
176 | } | ||
177 | #endif | ||
178 | |||
179 | viewer_app_ptr->cleanup(); | ||
180 | |||
181 | #if WINDOWS_CRT_MEM_CHECKS | ||
182 | llinfos << "CRT Checking memory:" << llendflush; | ||
183 | if (!_CrtCheckMemory()) | ||
184 | { | ||
185 | llwarns << "_CrtCheckMemory() failed after cleanup!" << llendflush; | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | llinfos << " No corruption detected." << llendflush; | ||
190 | } | ||
191 | #endif | ||
192 | |||
160 | } | 193 | } |
161 | delete viewer_app_ptr; | 194 | delete viewer_app_ptr; |
162 | viewer_app_ptr = NULL; | 195 | viewer_app_ptr = NULL; |
@@ -298,7 +331,7 @@ void LLAppViewerWin32::initConsole() | |||
298 | 331 | ||
299 | void write_debug_dx(const char* str) | 332 | void write_debug_dx(const char* str) |
300 | { | 333 | { |
301 | LLString value = gDebugInfo["DXInfo"].asString(); | 334 | std::string value = gDebugInfo["DXInfo"].asString(); |
302 | value += str; | 335 | value += str; |
303 | gDebugInfo["DXInfo"] = value; | 336 | gDebugInfo["DXInfo"] = value; |
304 | } | 337 | } |
@@ -347,7 +380,7 @@ bool LLAppViewerWin32::initHardwareTest() | |||
347 | "\n" | 380 | "\n" |
348 | "Do you wish to continue?\n"; | 381 | "Do you wish to continue?\n"; |
349 | S32 button = OSMessageBox( | 382 | S32 button = OSMessageBox( |
350 | msg.str().c_str(), | 383 | msg.str(), |
351 | "Warning", | 384 | "Warning", |
352 | OSMB_YESNO); | 385 | OSMB_YESNO); |
353 | if (OSBTN_NO== button) | 386 | if (OSBTN_NO== button) |
@@ -367,7 +400,7 @@ bool LLAppViewerWin32::initHardwareTest() | |||
367 | std::ostringstream splash_msg; | 400 | std::ostringstream splash_msg; |
368 | splash_msg << "Loading " << LLAppViewer::instance()->getSecondLifeTitle() << "..."; | 401 | splash_msg << "Loading " << LLAppViewer::instance()->getSecondLifeTitle() << "..."; |
369 | 402 | ||
370 | LLSplashScreen::update(splash_msg.str().c_str()); | 403 | LLSplashScreen::update(splash_msg.str()); |
371 | } | 404 | } |
372 | 405 | ||
373 | if (!LLWinDebug::checkExceptionHandler()) | 406 | if (!LLWinDebug::checkExceptionHandler()) |
@@ -395,14 +428,17 @@ bool LLAppViewerWin32::initParseCommandLine(LLCommandLineParser& clp) | |||
395 | { | 428 | { |
396 | if (success >= 2 && locale->lang) // confident! | 429 | if (success >= 2 && locale->lang) // confident! |
397 | { | 430 | { |
431 | LL_INFOS("AppInit") << "Language: " << ll_safe_string(locale->lang) << LL_ENDL; | ||
432 | LL_INFOS("AppInit") << "Location: " << ll_safe_string(locale->country) << LL_ENDL; | ||
433 | LL_INFOS("AppInit") << "Variant: " << ll_safe_string(locale->variant) << LL_ENDL; | ||
398 | LLControlVariable* c = gSavedSettings.getControl("SystemLanguage"); | 434 | LLControlVariable* c = gSavedSettings.getControl("SystemLanguage"); |
399 | if(c) | 435 | if(c) |
400 | { | 436 | { |
401 | c->setValue(std::string(locale->lang), false); | 437 | c->setValue(std::string(locale->lang), false); |
402 | } | 438 | } |
403 | } | 439 | } |
404 | FL_FreeLocale(&locale); | ||
405 | } | 440 | } |
441 | FL_FreeLocale(&locale); | ||
406 | 442 | ||
407 | return true; | 443 | return true; |
408 | } | 444 | } |