[libpeas] Fix offsets in interface handling (take 2)



commit 26033ccaf84386239636c9862a141dd01a8dd3dc
Author: Steve Frécinaux <code istique net>
Date:   Wed Sep 1 19:27:50 2010 +0200

    Fix offsets in interface handling (take 2)
    
    There is an offset in GI function arguments between GICallbackInfo
    (which includes the instance pointer as the first argument) and
    GIFunctionInfo (which doesn't when the function is a method).
    
    And of course, we got it wrong the first time.

 libpeas/peas-extension-subclasses.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/libpeas/peas-extension-subclasses.c b/libpeas/peas-extension-subclasses.c
index a6cf6eb..03d4a17 100644
--- a/libpeas/peas-extension-subclasses.c
+++ b/libpeas/peas-extension-subclasses.c
@@ -68,14 +68,14 @@ handle_method_impl (ffi_cif  *cif,
   g_assert (PEAS_IS_EXTENSION (instance));
 
   n_args = g_callable_info_get_n_args (impl->info);
-  arguments = g_newa (GArgument, n_args);
+  arguments = g_newa (GArgument, n_args-1);
 
   for (i = 1; i < n_args; i++)
     {
       arg_info = g_callable_info_get_arg (impl->info, i);
       type_info = g_arg_info_get_type (arg_info);
 
-      peas_gi_pointer_to_argument (type_info, args[i + 1], &arguments[i]);
+      peas_gi_pointer_to_argument (type_info, args[i], &arguments[i-1]);
 
       g_base_info_unref (type_info);
       g_base_info_unref (arg_info);
@@ -93,7 +93,7 @@ handle_method_impl (ffi_cif  *cif,
       if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT)
         {
           type_info = g_arg_info_get_type (arg_info);
-          peas_gi_argument_to_pointer (type_info, &arguments[i], args[i + 1]);
+          peas_gi_argument_to_pointer (type_info, &arguments[i-1], args[i]);
           g_base_info_unref (type_info);
         }
 



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