[gjs/gnome-3-36] function: Pass the deferenced callback out pointer value to JS
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/gnome-3-36] function: Pass the deferenced callback out pointer value to JS
- Date: Sat, 28 Mar 2020 05:50:25 +0000 (UTC)
commit f2b8d4519c32e7cd250642829eecfaabecf3d63a
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Mon Mar 16 23:24:44 2020 +0100
function: Pass the deferenced callback out pointer value to JS
When a callback function (vfunc) uses inout arguments, we used to
compute the JS::Value from the argument as is (and so computing the
value from the pointer value), however in such case the argument itself is
a pointer and so we need to get its actual value by deferencing the GIArgument
pointer.
gi/function.cpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gi/function.cpp b/gi/function.cpp
index 340792b1..6b8baf70 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -322,16 +322,19 @@ static void gjs_callback_closure(ffi_cif* cif G_GNUC_UNUSED, void* result,
goto out;
break;
}
- case PARAM_NORMAL:
+ case PARAM_NORMAL: {
if (!jsargs.growBy(1))
g_error("Unable to grow vector");
+ GIArgument* arg = args[i + c_args_offset];
+ if (g_arg_info_get_direction(&arg_info) == GI_DIRECTION_INOUT)
+ arg = *reinterpret_cast<GIArgument**>(arg);
+
if (!gjs_value_from_g_argument(context, jsargs[n_jsargs++],
- &type_info,
- args[i + c_args_offset],
- false))
+ &type_info, arg, false))
goto out;
break;
+ }
case PARAM_CALLBACK:
/* Callbacks that accept another callback as a parameter are not
* supported, see gjs_callback_trampoline_new() */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]