GNOME Bugzilla – Bug 623664
Missing accessors for gtk_menu_get_position_func{,_data}
Last modified: 2010-09-24 17:56:40 UTC
For building PyGtk against Gtk-3.0 [1] Subject is slightly misleading. More context in code comment [2] /* this is an ugly hack to avoid leaking memory and references gtk_menu_popup should use a data destroy function */ - if (menu->position_func == pygtk_menu_position) { - cunote = menu->position_func_data; + if (menu->_g_sealed__position_func == pygtk_menu_position) { + cunote = menu->_g_sealed__position_func_data; Py_DECREF(cunote->func); Py_XDECREF(cunote->data); g_free(cunote); [1] http://mail.gnome.org/archives/gtk-devel-list/2010-July/msg00005.html [2] http://github.com/nzjrs/pygtk/blob/902c7fa012bc62cd0f927ff5d2642dff64a422be/gtk/gtk.override#L1624
That looks just wrong to me. If there is a problem with the data passed to the menu position func, we need a way to associate a destroy notify, not a hack like this.
So would a patch adding gtk_menu_popup_full be considered?
yes
I just noticed bug 345349 has a patch [1] that adds destroy notify to gtk_menu_popup_for_device. I wonder if it would be possible to just backport gtk_menu_popup_for_device to gtk+-2.22/4 https://bugzilla.gnome.org/show_bug.cgi?id=345349#c11
Ugh, that patch was meant to be attached here. But no, backporting is not an option. gtk_menu_popup_for_device() is part of a complete rewrite of the input device handling code in gtk3.
You can probably work around the issue by using g_object_set_data and ::destroy.
Committed the patch mentioned in comment 4.