[Webkit-unassigned] [Bug 16401] [GTK] GObject/C DOM binding

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 15 08:21:26 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=16401





------- Comment #44 from lkcl at lkcl.net  2008-09-15 08:21 PDT -------
ok.  chasing through python-gobject, a string property in the "getter"
functions is passed to "PyString_AsString()" - not "PyString_FromString()".

PyString_AsString "takes over" the string data.
PyString_FromString makes a copy.

in other words, the convention is "caller responsible for freeing".

in other words, the last thing i want to do is to make the gdom bindings return
"unmodifiable" copies of strings for which the library itself is responsible.

removing "const gchar*" and making it "gchar*", and then specifying "
(caller-owns-return #t)" makes sure that pywebkitgtk takes responsibility for
the memory.  hmm, looks like codegen.py could do with an optimisation by using
AsString and then _not_ free()ing the string it's been passed, but that's
another story.

talking to people on the gtk-devel-mailing list:

http://mail.gnome.org/archives/gtk-devel-list/2008-September/msg00080.html

one person says, basically, that GC is really fraught with difficulties.

overall, i get the impression that a simple convention "caller responsible
for freeing" not only makes everybody's lives easier, but is also expected.

certainly python-gobject and pygtk's codegen that looks like it's the case.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list