diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 01:37:53 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 01:37:53 +0000 |
commit | 1b5237ecc1fea39e51e1634acbcdf11bd7ef57b0 (patch) | |
tree | 825babec0c6bf1e4ad5433585fe3690748803c59 /chrome/app/breakpad_win.cc | |
parent | b6a6cd102bb4859707c12a09fbf1e35b1e5e0af2 (diff) | |
download | chromium_src-1b5237ecc1fea39e51e1634acbcdf11bd7ef57b0.zip chromium_src-1b5237ecc1fea39e51e1634acbcdf11bd7ef57b0.tar.gz chromium_src-1b5237ecc1fea39e51e1634acbcdf11bd7ef57b0.tar.bz2 |
Stop compulsive crasher in respawn dialog
- Users with CursorXP or FontExporer crash in MessageBoxW
- leads to many crash reports within seconds
solution: eat the fatal exception and exit silently.
TEST = see the bug for instructions
BUG = 12162
Review URL: http://codereview.chromium.org/118148
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17461 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/breakpad_win.cc')
-rw-r--r-- | chrome/app/breakpad_win.cc | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc index b2644ba..439343a 100644 --- a/chrome/app/breakpad_win.cc +++ b/chrome/app/breakpad_win.cc @@ -18,6 +18,7 @@ #include "chrome/app/google_update_client.h" #include "chrome/app/hard_error_handler_win.h" #include "chrome/common/env_vars.h" +#include "chrome/common/result_codes.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/google_update_settings.h" #include "breakpad/src/client/windows/handler/exception_handler.h" @@ -200,27 +201,38 @@ bool ShowRestartDialogIfCrashed(bool* exit_now) { if (!len) return true; - wchar_t* restart_data = new wchar_t[len + 1]; - ::GetEnvironmentVariableW(env_vars::kRestartInfo, restart_data, len); - restart_data[len] = 0; - // The CHROME_RESTART var contains the dialog strings separated by '|'. - // See PrepareRestartOnCrashEnviroment() function for details. - std::vector<std::wstring> dlg_strings; - SplitString(restart_data, L'|', &dlg_strings); - delete[] restart_data; - if (dlg_strings.size() < 3) - return true; - - // If the UI layout is right-to-left, we need to pass the appropriate MB_XXX - // flags so that an RTL message box is displayed. - UINT flags = MB_OKCANCEL | MB_ICONWARNING; - if (dlg_strings[2] == env_vars::kRtlLocale) - flags |= MB_RIGHT | MB_RTLREADING; - - // Show the dialog now. It is ok if another chrome is started by the - // user since we have not initialized the databases. - *exit_now = (IDOK != ::MessageBoxW(NULL, dlg_strings[1].c_str(), - dlg_strings[0].c_str(), flags)); + // We wrap the call to MessageBoxW with a SEH handler because it some + // machines with CursorXP, PeaDict or with FontExplorer installed it crashes + // uncontrollably here. Being this a best effort deal we better go away. +#pragma warning(push) +#pragma warning(disable:4509) // warning: SEH used but dlg_strings has a dtor. + __try { + wchar_t* restart_data = new wchar_t[len + 1]; + ::GetEnvironmentVariableW(env_vars::kRestartInfo, restart_data, len); + restart_data[len] = 0; + // The CHROME_RESTART var contains the dialog strings separated by '|'. + // See PrepareRestartOnCrashEnviroment() function for details. + std::vector<std::wstring> dlg_strings; + SplitString(restart_data, L'|', &dlg_strings); + delete[] restart_data; + if (dlg_strings.size() < 3) + return true; + + // If the UI layout is right-to-left, we need to pass the appropriate MB_XXX + // flags so that an RTL message box is displayed. + UINT flags = MB_OKCANCEL | MB_ICONWARNING; + if (dlg_strings[2] == env_vars::kRtlLocale) + flags |= MB_RIGHT | MB_RTLREADING; + + // Show the dialog now. It is ok if another chrome is started by the + // user since we have not initialized the databases. + *exit_now = (IDOK != ::MessageBoxW(NULL, dlg_strings[1].c_str(), + dlg_strings[0].c_str(), flags)); + } __except(EXCEPTION_EXECUTE_HANDLER) { + // Its not safe to continue executing, exit silently here. + ::ExitProcess(ResultCodes::RESPAWN_FAILED); + } +#pragma warning(pop) return true; } |