gtk-rs / gtk3-rs

Rust bindings for GTK 3
https://gtk-rs.org
MIT License
508 stars 90 forks source link

Quoting C documentation regarding the use of Rust methods is not helpful #842

Closed donaldcallen closed 10 months ago

donaldcallen commented 10 months ago

For example, the documentation for TreeModelExt::path says

"This path should be freed with gtk_tree_path_free()."

You can't pass a TreePath to gtk_sys::gtk_tree_path_free, whose argument is of type *mut GtkTreePath.

It's not even clear that the path returned needs to manually freed. My guess is that your code cleans up the gtk_tree_path when the TreePath struct is dropped. Interestingly, the documentation for the corresponding TreeModelExt::iter method says nothing about manually free-ing the returned iter struct.

donaldcallen commented 10 months ago

It is really unhelpful to simply close this issue without any explanation.

GuillaumeGomez commented 10 months ago

Sorry, wrong button. So I said:

It's a known issue. Docs and code are generated from the GIR files and we don't intend to rewrite it. Fixing it upstream would be also quite complicated (but doable), but that's a completely different scale of work.