diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2017-09-13 18:05:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-13 18:05:31 +0200 |
commit | d6b392825fc3e22d9e0c62f0d17633c4224eb28f (patch) | |
tree | 5c9bc70e0a9ad094fb22398d9ba6e57bc09aba85 /platform/windows/godot_win.cpp | |
parent | 322b0bee4967545383fba8a2c9b1253e2a2bbf43 (diff) | |
parent | 83fe9373621ab9f7e175a43868b2eda935107539 (diff) |
Merge pull request #11061 from marcelofg55/dump_backtrace
Add a segfault handler to dump the backtrace on Windows, Linux and OS X
Diffstat (limited to 'platform/windows/godot_win.cpp')
-rw-r--r-- | platform/windows/godot_win.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/platform/windows/godot_win.cpp b/platform/windows/godot_win.cpp index d2ac6ecb50..4450cb3670 100644 --- a/platform/windows/godot_win.cpp +++ b/platform/windows/godot_win.cpp @@ -157,24 +157,32 @@ int widechar_main(int argc, wchar_t **argv) { }; int main(int _argc, char **_argv) { - // _argc and _argv are ignored - // we are going to use the WideChar version of them instead +// _argc and _argv are ignored +// we are going to use the WideChar version of them instead - LPWSTR *wc_argv; - int argc; - int result; +#ifdef CRASH_HANDLER_EXCEPTION + __try { +#endif + LPWSTR *wc_argv; + int argc; + int result; - wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc); + wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc); - if (NULL == wc_argv) { - wprintf(L"CommandLineToArgvW failed\n"); - return 0; - } + if (NULL == wc_argv) { + wprintf(L"CommandLineToArgvW failed\n"); + return 0; + } - result = widechar_main(argc, wc_argv); + result = widechar_main(argc, wc_argv); - LocalFree(wc_argv); - return result; + LocalFree(wc_argv); + return result; +#ifdef CRASH_HANDLER_EXCEPTION + } __except (CrashHandlerException(GetExceptionInformation())) { + return 1; + } +#endif } HINSTANCE godot_hinstance = NULL; |