From dcbc6a127bb97e97a0cc63e16d4f6de01f558230 Mon Sep 17 00:00:00 2001 From: Andy Dill Date: Thu, 30 Apr 2015 16:46:33 -0700 Subject: [PATCH 1/2] Explicitly null the crash reporter before assigning it to allow the EH to unregister. --- atom/common/crash_reporter/crash_reporter_win.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/atom/common/crash_reporter/crash_reporter_win.cc b/atom/common/crash_reporter/crash_reporter_win.cc index e5c5edc582ae..ebb9a784da54 100644 --- a/atom/common/crash_reporter/crash_reporter_win.cc +++ b/atom/common/crash_reporter/crash_reporter_win.cc @@ -54,6 +54,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name, if (waiting_event != INVALID_HANDLE_VALUE) WaitForSingleObject(waiting_event, 1000); + breakpad_.reset(nullptr); int handler_types = google_breakpad::ExceptionHandler::HANDLER_EXCEPTION | google_breakpad::ExceptionHandler::HANDLER_PURECALL; breakpad_.reset(new google_breakpad::ExceptionHandler( From 9a768dd4f0f55149d8dbcbb191d559c42dfbc646 Mon Sep 17 00:00:00 2001 From: Andy Dill Date: Thu, 21 May 2015 08:54:27 -0700 Subject: [PATCH 2/2] Remove explicit nullptr and add clarifying comment. --- atom/common/crash_reporter/crash_reporter_win.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/atom/common/crash_reporter/crash_reporter_win.cc b/atom/common/crash_reporter/crash_reporter_win.cc index ebb9a784da54..a348cf012612 100644 --- a/atom/common/crash_reporter/crash_reporter_win.cc +++ b/atom/common/crash_reporter/crash_reporter_win.cc @@ -54,7 +54,11 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name, if (waiting_event != INVALID_HANDLE_VALUE) WaitForSingleObject(waiting_event, 1000); - breakpad_.reset(nullptr); + // ExceptionHandler() attaches our handler and ~ExceptionHandler() detaches + // it, so we must explicitly reset *before* we instantiate our new handler + // to allow any previous handler to detach in the correct order. + breakpad_.reset(); + int handler_types = google_breakpad::ExceptionHandler::HANDLER_EXCEPTION | google_breakpad::ExceptionHandler::HANDLER_PURECALL; breakpad_.reset(new google_breakpad::ExceptionHandler(