[perl-Glib-Object-Introspection] Always allow undef for out/inout args for Perl callbacks



commit e22ccc98df0551a794c053411848ed2e6485c907
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Fri Jan 25 17:59:37 2013 +0100

    Always allow undef for out/inout args for Perl callbacks

 NEWS                     |    4 +++-
 gperl-i11n-invoke-perl.c |    9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 5178025..ab225b2 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,9 @@ 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.
 * Rework the way fallback vfuncs are installed.
-* Correctly marshal in-out args when invoking Perl code.
+* Correctly marshal out/in-out args when invoking Perl code and fix some other
+  related bugs.  This makes it possible to implement complicated interfaces
+  such as Gtk3::TreeModel.
 * Plug a few memory leaks.
 
 Overview of changes in Glib::Object::Introspection 0.013
diff --git a/gperl-i11n-invoke-perl.c b/gperl-i11n-invoke-perl.c
index e2c6c6f..12f374f 100644
--- a/gperl-i11n-invoke-perl.c
+++ b/gperl-i11n-invoke-perl.c
@@ -201,7 +201,14 @@ invoke_perl_code (ffi_cif* cif, gpointer resp, gpointer* args, gpointer userdata
 			{
 				GIArgument tmp_arg;
 				GITransfer transfer = g_arg_info_get_ownership_transfer (arg_info);
-				gboolean may_be_null = g_arg_info_may_be_null (arg_info);
+				/* g_arg_info_may_be_null (arg_info) is not
+				 * appropriate here as it describes whether the
+				 * out/inout arg itself may be NULL.  But we're
+				 * asking here whether it is OK store NULL
+				 * inside the out/inout arg.  This information
+				 * does not seem to be present in the typelib
+				 * (nor is there an annotation for it). */
+				gboolean may_be_null = TRUE;
 				gboolean is_caller_allocated = g_arg_info_is_caller_allocates (arg_info);
 				if (is_caller_allocated) {
 					tmp_arg.v_pointer = out_pointer;



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