[gjs/ewlsh/fix-callback-exit] Ensure exit when a closure fails after marshal.
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/ewlsh/fix-callback-exit] Ensure exit when a closure fails after marshal.
- Date: Fri, 12 Feb 2021 01:41:57 +0000 (UTC)
commit 19fa52d545519d8fd5eea5df3175307abd0b145c
Author: Evan Welsh <contact evanwelsh com>
Date: Thu Feb 11 17:41:09 2021 -0800
Ensure exit when a closure fails after marshal.
We didn't correctly check for an exit condition after mashalling,
this caused a discrepancy with our other callback code and segfaults
if System.exit was used in signal callbacks.
Fixes #19
gi/value.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/gi/value.cpp b/gi/value.cpp
index c9bb7f25..2dacf7fa 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -259,7 +259,15 @@ closure_marshal(GClosure *closure,
}
JS::RootedValue rval(context);
- mozilla::Unused << gjs_closure_invoke(closure, nullptr, argv, &rval, false);
+
+ if (!gjs_closure_invoke(closure, nullptr, argv, &rval, false)) {
+ // "Uncatchable" exception thrown, we have to exit. This
+ // matches the closure exit handling in function.cpp
+ uint8_t code;
+ if (gjs->should_exit(&code))
+ exit(code);
+ }
+
// Any exception now pending, is handled when returning control to JS
if (return_value != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]