From f13354f9ea07092686f14ac1daf59175adaf8f2c Mon Sep 17 00:00:00 2001 From: Johan Bilien Date: Tue, 24 Feb 2009 15:19:07 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20572965=20=E2=80=93=20Allow=20generic=20ma?= =?UTF-8?q?rshaller=20to=20be=20called=20without=20parameters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit girepository/ginvoke.c: handle the case where n_param_values == 0. tests/invoke/genericmarshaller.c: add a test case for this. --- ginvoke.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/ginvoke.c b/ginvoke.c index e83a8200a..70d81f8e9 100644 --- a/ginvoke.c +++ b/ginvoke.c @@ -407,18 +407,26 @@ gi_cclosure_marshal_generic (GClosure *closure, atypes = g_alloca (sizeof (ffi_type *) * n_args); args = g_alloca (sizeof (gpointer) * n_args); - if (G_CCLOSURE_SWAP_DATA (closure)) + if (n_param_values > 0) { - atypes[n_args-1] = value_to_ffi_type (param_values + 0, - &args[n_args-1]); - atypes[0] = &ffi_type_pointer; - args[0] = &closure->data; + if (G_CCLOSURE_SWAP_DATA (closure)) + { + atypes[n_args-1] = value_to_ffi_type (param_values + 0, + &args[n_args-1]); + atypes[0] = &ffi_type_pointer; + args[0] = &closure->data; + } + else + { + atypes[0] = value_to_ffi_type (param_values + 0, &args[0]); + atypes[n_args-1] = &ffi_type_pointer; + args[n_args-1] = &closure->data; + } } else { - atypes[0] = value_to_ffi_type (param_values + 0, &args[0]); - atypes[n_args-1] = &ffi_type_pointer; - args[n_args-1] = &closure->data; + atypes[0] = &ffi_type_pointer; + args[0] = &closure->data; } for (i = 1; i < n_args - 1; i++)