Free TreePath? Is it necessary?

If you search the gtk documentation for get_path, one of the hits is

see* gtk::prelude::TreeModelExt::path

That takes you to a description of the TreeModel path method, which takes an iter and returns an
Option<TreePath>. The method’s description includes this line:

“This path should be freed with gtk_tree_path_free() .”

gtk_tree_path_free cannot be called with a TreePath; it takes a raw pointer to a GtkTreePath.

Two questions:

  1. Does the TreePath really need to be freed, or is that taken care of when the TreePath structure wrapping the actual treepath is dropped? If the latter, the documentation should be fixed.
  2. If it does need to be freed, how do you extract a pointer to the GtkTreePath struct from the TreePath Rust struct?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.