[gjs] Skip only user_data in callbacks



commit 97e08e590609c2777910c3b89b6b0e7f64a7aa08
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Jul 13 13:44:05 2011 +0200

    Skip only user_data in callbacks
    
    Previously, all void* arguments in callbacks were skipped. Now we
    check in the closure id in the caching layer and correctly mark
    them skipped.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=654406

 gi/function.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gi/function.c b/gi/function.c
index 9834ab3..b2cfa07 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -230,10 +230,6 @@ gjs_callback_closure(ffi_cif *cif,
         g_callable_info_load_arg(trampoline->info, i, &arg_info);
         g_arg_info_load_type(&arg_info, &type_info);
 
-        /* Skip void * arguments */
-        if (g_type_info_get_tag(&type_info) == GI_TYPE_TAG_VOID)
-            continue;
-
         if (g_arg_info_get_direction(&arg_info) == GI_DIRECTION_OUT) {
             n_outargs++;
             continue;
@@ -453,6 +449,7 @@ gjs_callback_trampoline_new(JSContext      *context,
         GIArgInfo arg_info;
         GITypeInfo type_info;
         GITypeTag type_tag;
+        gint closure;
 
         if (trampoline->param_types[i] == PARAM_SKIPPED)
             continue;
@@ -468,6 +465,14 @@ gjs_callback_trampoline_new(JSContext      *context,
             continue;
         }
 
+        closure = g_arg_info_get_closure(&arg_info);
+        if (closure == i) {
+            /* A closure id equal to current parameter is used to signal the user_data
+               argument in a callback */
+            trampoline->param_types[i] = PARAM_SKIPPED;
+            continue;
+        }
+
         if (type_tag == GI_TYPE_TAG_INTERFACE) {
             GIBaseInfo* interface_info;
             GIInfoType interface_type;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]