[gjs] function: Handle callbacks with no return value
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] function: Handle callbacks with no return value
- Date: Fri, 11 Nov 2016 00:25:42 +0000 (UTC)
commit a5f644f9d31dbe808b60deaab8c1679d85d5b2d5
Author: Philip Chimento <philip endlessm com>
Date: Thu Nov 10 13:31:38 2016 -0800
function: Handle callbacks with no return value
Previously this was handled by the else clause in this if statement, but
since we switched to rooting, we call .toObjectOrNull() on the callback's
return value. In the case of no return value, the JS return value is
undefined.
We could handle this lower down in the existing else clause, but this
seems easier to understand.
https://bugzilla.gnome.org/show_bug.cgi?id=742249
gi/function.cpp | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gi/function.cpp b/gi/function.cpp
index 4e748ef..ee68333 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -301,7 +301,9 @@ gjs_callback_closure(ffi_cif *cif,
g_callable_info_load_return_type(trampoline->info, &ret_type);
ret_type_is_void = g_type_info_get_tag (&ret_type) == GI_TYPE_TAG_VOID;
- if (n_outargs == 0 && !ret_type_is_void) {
+ if (n_outargs == 0 && ret_type_is_void) {
+ /* void return value, no out args, nothing to do */
+ } else if (n_outargs == 0) {
GIArgument argument;
GITransfer transfer;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]