GNOME Bugzilla – Bug 586438
Gtk::TreeView::row_activated require a TreeViewColumn &
Last modified: 2016-09-26 09:01:20 UTC
Gtk::TreeView::row_activated() require a TreeViewColumn. But TreeView::get_path_at_pos() can return a NULL TreeViewColumn*. So we need an overload that either just accept a TreeViewColumn* or one that does not require the parameter. I can provide a patch if you want.
I don't quite understand what you need. The gtk_tree_vie_row_activated() documentation does not mention that the GtkTreeViewColumn* can be NULL, or what that would mean: http://library.gnome.org/devel/gtk/unstable/GtkTreeView.html#gtk-tree-view-row-activated
Hubert? Please reply.
I'm still waiting for some explanation. If there's a problem, I'd like to fix it.
I think what Hubert is saying is that since Gtk::TreeView::row_activated() needs a Gtk::TreeViewColumn &, and TreeView::get_path_at_pos() might keep the Gtk::TreeViewColumn *& passed to it as 0, it can not be safely deferenced and passed to Gtk::TreeView::row_activated. However the documentation does not mention whether TreeView::get_path_at_pos() can indeed keep it as 0. The C API just says that if a valid GtkTreeViewColumn ** is passed, then it is set to the correct column.
But we still need to to know what NULL means for that C function.
The documentation of gtk_tree_view_get_path_at_pos() could be clearer. A look at the code shows that the function returns with *column == NULL only if the function's return value is FALSE, i.e. no row exists at the given x and y coordinates. In that case *path is also NULL. The output from gtk_tree_view_get_path_at_pos(), and from Gtk::TreeView::get_path_at_pos() is not very useful in that case. The documentation of gtk_tree_view_row_activated() annotates neither path nor column with [allow-none]. Which means that they are not supposed to be NULL pointers. The documentation says: "Activates the cell determined by @path and @column." Note: "cell", not "row". So why isn't the function called gtk_tree_view_cell_activated()? I don't know. My conclusion is that we shall not add a void row_activated(const TreeModel::Path& path, TreeViewColumn* column) or void row_activated(const TreeModel::Path& path)
Closing this bug, due to my conclusion in comment 6. Feel free to reopen it, if you disagree. But then please explain what makes you believe that it's acceptable to pass NULL for column to gtk_tree_view_row_activated().