After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 685994 - Introspection broken for TextBuffer serialization stuff
Introspection broken for TextBuffer serialization stuff
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Language Bindings
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-10-11 17:40 UTC by Julian Andres Klode
Modified: 2018-04-15 00:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Julian Andres Klode 2012-10-11 17:40:55 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.
Comment 1 Matthias Clasen 2018-02-10 05:01:32 UTC
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.
Comment 2 Matthias Clasen 2018-04-15 00:15:06 UTC
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