[gjs/gnome-3-34] arg: Save exception state when releasing an array



commit 2ea690f9ec3ef6ae0cac9729ed91ead299db9a04
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 f7bca148..9411f8f9 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -3813,6 +3813,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]