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 693393 - Add virtual functions with (transfer full) to support language bindings
Add virtual functions with (transfer full) to support language bindings
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Language Bindings
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 708060
 
 
Reported: 2013-02-08 02:50 UTC by Simon Feltman
Modified: 2018-04-15 00:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add virtual functions with (transfer full) to support language bindings (5.62 KB, patch)
2013-02-08 03:00 UTC, Simon Feltman
none Details | Review

Description Simon Feltman 2013-02-08 02:50:06 UTC
There are currently a handful of virtual function which are intended to return a new object but are marked as (transfer none). This causes problems because language bindings always sink newly created objects. Marshaling of the object from the language binding as a return value for a vfunc will then return a bad object because the sunk object is destroyed along with the language bindings wrapper (as the wrapper owns it). For example:

class ToolMenuAction(Gtk.Action):
    def do_create_tool_item(self):
        return Gtk.MenuToolButton()

APIs with virtual functions returning new objects should therefor only be marked as (transfer full). Doing this to the existing vfuncs would obviously cause breakage. This is a proposal to test the waters and see if the technique of adding alternate vfuncs for language binding support is acceptable.

There are a few alternative ways to fix the problem:
1. Force users of language bindings to use workarounds. This also adds extra support when they run into the problem and file ticket/ask questions.
2. Add hacks to language bindings themself. This might be possible but it is tricky and would need to be done to all language bindings.

The following is a list of problematic virtual functions for language bindings:

Gtk.Action.create_menu
Gtk.Action.create_menu_item
Gtk.Action.create_tool_item
Gtk.PrintOperation.create_custom_widget
Gtk.PrintOperation.create-custom-widget (signal)
Gladeui.EditorProperty.create_input
Gladeui.BaseEditor.build_child?
Gladeui.BaseEditor.build-child (signal)
Comment 1 Simon Feltman 2013-02-08 03:00:30 UTC
Created attachment 235478 [details] [review]
Add virtual functions with (transfer full) to support language bindings

Add alternative virtual functions for create_menu, create_menu_item,
and create_tool_item needed for language binding support. The new
methods have "_transfer_full" as a suffix to explicity match that
of the annotation. The existing vfuncs will continue to work and
are API/ABI compatible.

NOTE: This is currently does not fix the problem become it seems
gi-scanner does not support renamed vfuncs. This is intended as a
potential solution which needs GTK+ developer feedback before pursuing
gi scanner problems.
Comment 2 Simon Feltman 2013-02-08 12:05:38 UTC
Additionally:
Gtk.CellRenderer.start_editing suffers the same problem.
Comment 3 Matthias Clasen 2018-02-10 05:03:10 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 4 Matthias Clasen 2018-04-15 00:20:03 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