=?utf-8?q?=5Bperl-Glib-Object-Introspection=5D_SV_=E2=86=92_GBoxed=3A_cor?= =?utf-8?q?rectly_handle_ownership_transfer_and_undef?=



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

    SV â GBoxed: correctly handle ownership transfer and undef

 gperl-i11n-marshal-interface.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gperl-i11n-marshal-interface.c b/gperl-i11n-marshal-interface.c
index c8a50d3..09025d0 100644
--- a/gperl-i11n-marshal-interface.c
+++ b/gperl-i11n-marshal-interface.c
@@ -194,15 +194,21 @@ sv_to_interface (GIArgInfo * arg_info,
 			       g_arg_info_is_caller_allocates (arg_info),
 			       g_type_info_is_pointer (type_info));
 			if (need_value_semantics) {
-				gsize n_bytes = g_struct_info_get_size (interface);
-				gpointer mem = gperl_get_boxed_check (sv, type);
-				g_memmove (arg->v_pointer, mem, n_bytes);
+				if (may_be_null && !gperl_sv_is_defined (sv)) {
+					/* Do nothing. */
+				} else {
+					gsize n_bytes = g_struct_info_get_size (interface);
+					gpointer mem = gperl_get_boxed_check (sv, type);
+					g_memmove (arg->v_pointer, mem, n_bytes);
+				}
 			} else {
 				if (may_be_null && !gperl_sv_is_defined (sv)) {
 					arg->v_pointer = NULL;
 				} else {
-					/* FIXME: Check transfer setting. */
 					arg->v_pointer = gperl_get_boxed_check (sv, type);
+					if (GI_TRANSFER_EVERYTHING == transfer)
+						arg->v_pointer = g_boxed_copy (
+							type, arg->v_pointer);
 				}
 			}
 		}



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