GNOME Bugzilla – Bug 651132
Strings in a boxed type get treated as weak references
Last modified: 2015-02-07 16:45:54 UTC
Given the following C code: typedef struct { gchar *family; gchar *given; gchar *additional; gchar *prefixes; gchar *suffixes; } EContactName; (skipping the copy/free methods APIs) and the following GIR code: <record name="ContactName" c:type="EContactName" glib:type-name="EContactName" glib:get-type="e_contact_name_get_type" c:symbol-prefix="contact_name"> <field name="family" writable="1"> <type name="utf8" c:type="gchar*"/> </field> <field name="given" writable="1"> <type name="utf8" c:type="gchar*"/> </field> <field name="additional" writable="1"> <type name="utf8" c:type="gchar*"/> </field> <field name="prefixes" writable="1"> <type name="utf8" c:type="gchar*"/> </field> <field name="suffixes" writable="1"> <type name="utf8" c:type="gchar*"/> </field> <constructor name="new" c:identifier="e_contact_name_new"> <doc xml:whitespace="preserve">Creates a new #EContactName struct.</doc> <return-value transfer-ownership="full"> <doc xml:whitespace="preserve">A new #EContactName struct.</doc> <type name="ContactName" c:type="EContactName*"/> </return-value> </constructor> <method name="copy" c:identifier="e_contact_name_copy"> <doc xml:whitespace="preserve">Creates a copy of @n.</doc> <return-value transfer-ownership="full"> <doc xml:whitespace="preserve">A new #EContactName identical to @n.</doc> <type name="ContactName" c:type="EContactName*"/> </return-value> </method> <method name="free" c:identifier="e_contact_name_free"> <doc xml:whitespace="preserve">Frees @name and its contents.</doc> <return-value transfer-ownership="none"> <type name="none" c:type="void"/> </return-value> </method> <method name="to_string" c:identifier="e_contact_name_to_string"> <doc xml:whitespace="preserve">Generates a string representation of @name.</doc> <return-value transfer-ownership="full"> <doc xml:whitespace="preserve">The string representation of @name.</doc> <type name="utf8" c:type="gchar*"/> </return-value> </method> </record> Vapigen generates the following (incorrect?) definitions: [CCode (copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "e_contact_address_get_type ()", cheader_filename = "libebook/e-book.h")] public class ContactAddress { public weak string address_format; public weak string code; public weak string country; public weak string ext; public weak string locality; public weak string po; public weak string region; public weak string street; public void free (); }
Reassigning to gobject-introspection. The gir format has not enough information whether assigning to a field should transfer ownership or not.
*** This bug has been marked as a duplicate of bug 561619 ***
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]