Selaa lähdekoodia

Don't terminate execution repeatedly

Stefan Siegl 9 vuotta sitten
vanhempi
commit
5f6d9aee2d
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  1. 7 0
      v8js_v8.cc

+ 7 - 0
v8js_v8.cc

@@ -202,6 +202,13 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value,
 
 void v8js_terminate_execution(v8::Isolate *isolate) /* {{{ */
 {
+	if(v8::V8::IsExecutionTerminating(isolate)) {
+		/* Execution already terminating, needn't trigger it again and
+		 * especially must not execute the spinning loop (which would cause
+		 * crashes in V8 itself, at least with 4.2 and 4.3 version lines). */
+		return;
+	}
+
 	/* Unfortunately just calling TerminateExecution on the isolate is not
 	 * enough, since v8 just marks the thread as "to be aborted" and doesn't
 	 * immediately do so.  Hence we enter an endless loop after signalling