chore: simplify intentional-crash code (#19464)

This commit is contained in:
Jeremy Apthorp 2019-07-29 11:36:16 -07:00 committed by GitHub
parent 71b1b69339
commit 33d1e87163
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,11 +35,6 @@ namespace electron {
namespace { namespace {
// Dummy class type that used for crashing the program.
struct DummyClass {
bool crash;
};
// Called when there is a fatal error in V8, we just crash the process here so // Called when there is a fatal error in V8, we just crash the process here so
// we can get the stack trace. // we can get the stack trace.
void FatalErrorCallback(const char* location, const char* message) { void FatalErrorCallback(const char* location, const char* message) {
@ -152,7 +147,8 @@ void ElectronBindings::Log(const base::string16& message) {
// static // static
void ElectronBindings::Crash() { void ElectronBindings::Crash() {
static_cast<DummyClass*>(nullptr)->crash = true; volatile int* zero = nullptr;
*zero = 0;
} }
// static // static