From 7d7036c9c6bcc067ac676c5a261a8b816c0e3f8b Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 4 Oct 2017 15:32:02 -0300 Subject: [PATCH] generator: Handle different gapi content if from bindinator or our parser Basically our "parser" does not generate for instance structure parent wherease bindinator generate (broken ones, being pointers instead of plain structures) --- Source/generator/ClassBase.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/generator/ClassBase.cs b/Source/generator/ClassBase.cs index 480b60698..04056f647 100644 --- a/Source/generator/ClassBase.cs +++ b/Source/generator/ClassBase.cs @@ -75,7 +75,7 @@ namespace GtkSharp.Generation { deprecated = elem.GetAttributeAsBoolean ("deprecated"); isabstract = elem.GetAttributeAsBoolean ("abstract"); abi_fields_valid = true; - bool has_parent = Elem.GetAttribute("parent") != ""; + string parent_type = Elem.GetAttribute("parent"); int num_abi_fields = 0; foreach (XmlNode node in elem.ChildNodes) { @@ -86,7 +86,13 @@ namespace GtkSharp.Generation { // Make sure ABI fields are taken into account, even when hidden. if (node.Name == "field") { num_abi_fields += 1; - if (num_abi_fields != 1 || !has_parent) { // Skip instance parent struct + // Skip instance parent struct if present, taking into account + // bindinator broken behaviour concerning parent field (ie. + // marking it as pointer, somehow risky but good enough for now.) + if (num_abi_fields != 1 || + parent_type == "" || + (member.GetAttribute("type").Replace("*", "") != parent_type + )) { abi_field = new StructABIField (member, this, "abi_info"); abi_fields.Add (abi_field); }