On 05-01-18 17:14, Luís Marques wrote:

On Fri, 05 Jan 2018 16:12:22 GMT, Luís Marques wrote:

One thing that surprised me, and I wonder if it might be related, is an apparent inconsistency between Gtk and GtkD, or between various GtkD methods of TreeModel: All of the methods listed in the [Gtk documentation for TreeModel][1] that deal with setting iterators have parameters with type GtkTreeIter* -- that is, TreeIter. On the other hand, on the GtkD side, we have getIter, iterNext, and iterNChildren which take a TreeIter (AKA GtkTreeIter*) and iterChildren, iterNthChild, iterParent which take an out TreeIter (AKA GtkTreeIter*). I wonder why this inconsistency exists, and if it might be related.

I meant GtkTreeIter* vs GtkTreeIter**, obviously.

I've found two issues with gtkd.Implement, and with those fixed things seem to work.

For a7456b5 a null check was missing for the returned object, causing a segfault when null was returned from getPath.

For 143fe42 In the case where an out TreeIter was used the generated code would set to pointer passed to the wrapper function to the adress of the new TreeIter instead of setting the data in the TreeIter.

For the GtkTreeIter* vs GtkTreeIter** the iters are marked with out because they are marked as such in the GObject introspection files.
Most of the time out parameters are indeed defined as GtkTreeIter** but it shouldn't matter much as the out documents that you will get an empty iter passed in that parameter. Tough the generated code should handle that case correctly which it wasn't.