[gjs] function: Don't unref info before we're done using it



commit dff230500b71f67c5a8740d1f11385be90b3841f
Author: Colin Walters <walters verbum org>
Date:   Wed Dec 1 18:23:43 2010 -0500

    function: Don't unref info before we're done using it
    
    The unref needs to be after we get the struct size.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=636263

 gi/function.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gi/function.c b/gi/function.c
index 1307d0d..ebd634c 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -518,7 +518,6 @@ gjs_invoke_c_function(JSContext      *context,
                         g_assert(interface_info != NULL);
 
                         interface_type = g_base_info_get_type(interface_info);
-                        g_base_info_unref((GIBaseInfo*)interface_info);
 
                         if (interface_type == GI_INFO_TYPE_STRUCT) {
                             size = g_struct_info_get_size((GIStructInfo*)interface_info);
@@ -528,6 +527,8 @@ gjs_invoke_c_function(JSContext      *context,
                             failed = TRUE;
                         }
 
+                        g_base_info_unref((GIBaseInfo*)interface_info);
+
                         if (!failed) {
                             in_arg_cvalues[in_args_pos].v_pointer = g_slice_alloc0(size);
                             out_arg_cvalues[out_args_pos].v_pointer = in_arg_cvalues[in_args_pos].v_pointer;



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