[perl-Glib-Object-Introspection] Correctly marshal in-out args when invoking Perl code
- From: Torsten SchÃnfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Glib-Object-Introspection] Correctly marshal in-out args when invoking Perl code
- Date: Tue, 8 Jan 2013 21:41:08 +0000 (UTC)
commit 1e016798d15f2ec7351ab0c52b83f78e42086cfe
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date: Tue Jan 8 01:26:41 2013 +0100
Correctly marshal in-out args when invoking Perl code
NEWS | 1 +
gperl-i11n-invoke-perl.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 188ba9f..028737a 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Overview of changes in Glib::Object::Introspection <next>
* Avoid using vfunc names that coincide with special Perl subs. This fixes
double-frees occurring for subclasses of Gtk3::Widget.
+* Correctly marshal in-out args when invoking Perl code.
Overview of changes in Glib::Object::Introspection 0.013
========================================================
diff --git a/gperl-i11n-invoke-perl.c b/gperl-i11n-invoke-perl.c
index b739c16..c8747c1 100644
--- a/gperl-i11n-invoke-perl.c
+++ b/gperl-i11n-invoke-perl.c
@@ -72,9 +72,16 @@ invoke_callback (ffi_cif* cif, gpointer resp, gpointer* args, gpointer userdata)
if (direction == GI_DIRECTION_IN ||
direction == GI_DIRECTION_INOUT)
{
+ gpointer raw;
GIArgument arg;
SV *sv;
- raw_to_arg (args[i], &arg, arg_type);
+ /* If the arg is in-out, then the ffi arg is a pointer
+ * to a pointer to a value, so we need to dereference
+ * it once. */
+ raw = direction == GI_DIRECTION_INOUT
+ ? *((gpointer *) args[i])
+ : args[i];
+ raw_to_arg (raw, &arg, arg_type);
sv = SAVED_STACK_SV (arg_to_sv (&arg, arg_type, transfer, &iinfo));
/* If arg_to_sv returns NULL, we take that as 'skip
* this argument'; happens for GDestroyNotify, for
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]