GNOME Bugzilla – Bug 685994
Introspection broken for TextBuffer serialization stuff
Last modified: 2018-04-15 00:15:06 UTC
I tried to port a Python application with a custom TextBuffer serializer and deserializer to GTK+ 3 with introspection. But the introspection seems broken, so that the deserializer gets a number instead of a string, amongst other things: 1. TypeError: register_deserialize_format() takes exactly 4 arguments (3 given) The C signature is: (GtkTextBuffer *buffer, const gchar *mime_type, GtkTextBufferDeserializeFunc function, gpointer user_data, GDestroyNotify user_data_destroy); As such the function should take 3 arguments. Same for register_serialize_format() 2. Deserialize callback gets 7 arguments: The argument types (in Python) are 'TextBuffer', 'TextBuffer', 'TextIter', 'int', 'long', 'bool', 'int'. The correct one would be: 'TextBuffer', 'TextBuffer', 'TextIter', string / array of characters, bool based on the signature of the callback: GtkTextBuffer *register_buffer, GtkTextBuffer *content_buffer, GtkTextIter *iter, const guint8 *data, gsize length, gboolean create_tags, gpointer user_data, GError **error); Bindings for Vala and Mono are broken too, they seem to ignore the '*' in the callback typedef, thus having a single char as the return value for the serializer, instead of an array of characters: public delegate uchar TextBufferSerializeFunc (Gtk.TextBuffer register_buffer, Gtk.TextBuffer content_buffer, Gtk.TextIter start, Gtk.TextIter end, size_t length); Vala also does not note that the length argument is a pointer to size_t. But those are probably other bugs caused somewhere in Vala (and Mono). I'm going to report this separately for Vala, I don't care about Mono, though.
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla. If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab: https://gitlab.gnome.org/GNOME/gtk/issues/new