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 695970 - gchar** struct members cannot be set
gchar** struct members cannot be set
Status: RESOLVED WONTFIX
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2013-03-16 15:37 UTC by chuchiperriman
Modified: 2014-12-19 07:06 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description chuchiperriman 2013-03-16 15:37:10 UTC
I cannot use Gtk.RecentData because I cannot set the needed properties. GtkRecentData is a struct but I cannot access to the struct fields using python gir
Comment 1 Timo Vanwynsberghe 2013-03-17 12:32:01 UTC
You should be able to access them as attributes, something like:

rd = Gtk.RecentData()
print rd.display_name
Comment 2 Martin Pitt 2013-03-18 07:18:27 UTC
With PyGObject 3.7.x you actually can set all the string (gchar*) fields, and is_private as well. The only struct field you can't set is the groups list (gchar**). In general it is really hard for an introspection language to correctly set pointer fields in structs, as it has little control and knowledge about its lifecycle and references, so this might not be fixable at all in PyGObject. It would be better if Gtk had a method/constructor for initializing a Gtk.RecentData struct then.

But I keep this open as we might be able to handle the gchar** special case with GStrv.

You don't need to set a value to .groups, though. I successfully called Gtk.RecentManager.add_full() with a struct with an empty groups.
Comment 3 Kai Willadsen 2013-10-05 02:17:38 UTC
(In reply to comment #2)
> You don't need to set a value to .groups, though. I successfully called
> Gtk.RecentManager.add_full() with a struct with an empty groups.

This is also an issue for Gtk.RecentFilterInfo. I have a use case for filtering by application, which is another gchar **. Fortunately, the MIME type in my case is unique, so this isn't a big deal.

Constructors for Gtk.RecentData and Gtk.RecentFilterInfo would fix the problem nicely however, and would be consistent with other API.
Comment 4 Simon Feltman 2014-02-06 03:41:26 UTC
This is pretty much looking like "won't fix" to me. I'm even a bit skeptical about the current support for setting string members because I can only guess they are leaking...

We might be able to track members which have been set and free them on PyObject destruction, but it would be tricky. I suggest logging an additional ticket with GTK+ to box these structs and add constructors which take arguments that require memory management.
Comment 5 Simon Feltman 2014-12-19 07:06:11 UTC
Marking as won't fix because I think the complexity of tracking assignments for freeing would be overly complicated. Please log bugs for adding constructors and accessor APIs for the structs in question.