[gjs/april-maintenance: 3/14] arg: Save exception state when releasing an array
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/april-maintenance: 3/14] arg: Save exception state when releasing an array
- Date: Tue, 5 May 2020 15:30:25 +0000 (UTC)
commit 3a303f3399cbb33477deeaaa321cf02cd85da063
Author: Philip Chimento <philip chimento gmail com>
Date: Thu Apr 30 21:43:05 2020 -0700
arg: Save exception state when releasing an array
In this loop, if an early element failed to release, then releasing
subsequent elements could call JSAPI functions with an exception already
pending. JS::AutoSaveExceptionState should do what we want here:
temporarily clear the exception, then put it back at the end of the
scope unless another exception was thrown.
gi/arg.cpp | 1 +
1 file changed, 1 insertion(+)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index abbb2ab6..cffd02e6 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -3834,6 +3834,7 @@ bool gjs_g_argument_release_out_array(JSContext* context, GITransfer transfer,
type_needs_out_release(param_type, type_tag)) {
for (i = 0; i < length; i++) {
elem.v_pointer = array[i];
+ JS::AutoSaveExceptionState saved_exc(context);
if (!gjs_g_arg_release_internal(context,
GI_TRANSFER_EVERYTHING,
param_type,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]