|Summary:||[GTK] Confusing webkit_uri_scheme_request_finish_error() description|
|Product:||WebKit||Reporter:||Milan Crha <mcrha>|
|Severity:||Normal||CC:||bugs-noreply, mcatanzaro, tpopela|
|Version:||WebKit Local Build|
Description Milan Crha 2017-01-27 02:47:10 PST
Comment 1 Michael Catanzaro 2017-01-27 08:02:43 PST
Hm, I agree that's kind of confusing for a C developer. Is it normal to use const to indicate transfer for GError parameters? The default annotation is transfer none, so it's unambiguous that all language bindings will maintain ownership and that your code should too, but I do understand why you expected it to be transfer full.
Comment 2 Milan Crha 2017-01-30 00:16:59 PST
I do not know how "normal" it is, I only try to keep APIs clean as much as possible, even in C, where the 'const' doesn't propagate to structure members. The hint with 'const' is like to mark a function 'const' in C++. Of course, there are some "issues" sometimes, when the corresponding API doesn't do the same, thus you can end with a silly typecast from const to non-const on an object where its get-function doesn't declare the object as const (and example can be a GSList/GList), though this is hidden to the caller. I'm fine if you do not want to change it to the 'const', just make it explicit in the documentation that the 'error' is not taken by the function. I consider confusing also , but maybe it's more about no explicit mention that the 'model' is referenced by the GtkTreeView. I understand that it's obvious when one knows about "default transfer method", but I confess I didn't know that. The closest to this webkit function might be , and even it's all deprecated, see the , which takes ownership of the 'error', but it's not properly annotated. GTask has this done properly, at least where I looked.  https://developer.gnome.org/gtk3/stable/GtkTreeView.html#gtk-tree-view-set-model  https://developer.gnome.org/gio/stable/GSimpleAsyncResult.html#g-simple-async-result-set-from-error  https://developer.gnome.org/gio/stable/GSimpleAsyncResult.html#g-simple-async-result-take-error
Comment 3 Michael Catanzaro 2017-01-30 06:40:55 PST
I don't think it's desirable to mention in freeform documentation whether you have to free a variable when we already use a structured unambiguous annotation language to describe that. I agree that it is confusing if you're not familiar with the rules for defaults; I have to look them up semi-regularly myself. gtk-doc could be improved to explicitly indicate default annotations in order to avoid such confusion. As for const, we normally only use const to indicate ownership of char* strings.