[perl-Glib-Object-Introspection] Add a work-around for determining the size of GValue



commit 6fc338aef539477f5df291b988ab420f302b00ff
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Tue Aug 23 00:18:00 2011 +0200

    Add a work-around for determining the size of GValue
    
    See <https://bugzilla.gnome.org/show_bug.cgi?id=657040>.

 GObjectIntrospection.xs |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/GObjectIntrospection.xs b/GObjectIntrospection.xs
index b7dab98..a36262e 100644
--- a/GObjectIntrospection.xs
+++ b/GObjectIntrospection.xs
@@ -399,7 +399,15 @@ size_of_interface (GITypeInfo *type_info)
 		if (g_type_info_is_pointer (type_info)) {
 			size = sizeof (gpointer);
 		} else {
-			size = g_struct_info_get_size ((GIStructInfo *) info);
+			/* FIXME: Remove this workaround once
+			 * gobject-introspection is fixed:
+			 * <https://bugzilla.gnome.org/show_bug.cgi?id=657040>. */
+			GType type = g_registered_type_info_get_g_type (info);
+			if (type == G_TYPE_VALUE) {
+				size = sizeof (GValue);
+			} else {
+				size = g_struct_info_get_size ((GIStructInfo *) info);
+			}
 		}
 		break;
 
@@ -2355,7 +2363,9 @@ allocate_out_mem (GITypeInfo *arg_type)
 	switch (type) {
 	    case GI_INFO_TYPE_STRUCT:
 	    {
-		gsize size = g_struct_info_get_size (interface_info);
+		/* No plain g_struct_info_get_size (interface_info) here so
+		 * that we get the GValue override. */
+		gsize size = size_of_interface (arg_type);
 		return g_malloc0 (size);
 	    }
 	    default:



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