GNOME Bugzilla – Bug 570419
Gtk::IconView::get_path_at_pos() shouldn't return invalid Gtk::TreePath
Last modified: 2009-02-06 03:56:26 UTC
The function wrapped by Gtk::IconView::get_path_at_pos() is gtk_icon_view_get_path_at_pos(). gtk_icon_view_get_path_at_pos() returns NULL if the x/y coordinates do not match up to an icon. Gtk::IconView::get_path_at_pos() returns a strange invalid Gtk::TreePath object with "gobj() == NULL" when the x/y coordinates do not match up to an icon. In my opinion Gtk::IconView::get_path_at_pos() should return an empty Gtk::TreePath object (ie: empty() == true) when the x/y coordinates do not match up to an icon.
I believe this is dealt with by this commit: 2009-01-19 Murray Cumming <murrayc@murrayc.com> * gtk/src/treepath.ccg: * gtk/src/treepath.hg: empty(): Also check for a null underlying GtkTreePath. Added operator bool() to do the same, just calling !empty().
Hmmm, are you sure this is right? bool TreePath::empty() const { if(!gobject_) return false; return (gtk_tree_path_get_depth(gobject_) == 0); } Seems like it should 'return true' to get the desired effect. It's one of those things about C++: empty() is always a double-negative slip waiting to happen. :)