Browse Source

chore: simplify intentional-crash code (#19464)

Jeremy Apthorp 5 years ago
parent
commit
33d1e87163
1 changed files with 2 additions and 6 deletions
  1. 2 6
      shell/common/api/electron_bindings.cc

+ 2 - 6
shell/common/api/electron_bindings.cc

@@ -35,11 +35,6 @@ namespace electron {
 
 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
 // we can get the stack trace.
 void FatalErrorCallback(const char* location, const char* message) {
@@ -152,7 +147,8 @@ void ElectronBindings::Log(const base::string16& message) {
 
 // static
 void ElectronBindings::Crash() {
-  static_cast<DummyClass*>(nullptr)->crash = true;
+  volatile int* zero = nullptr;
+  *zero = 0;
 }
 
 // static