After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 570419 - Gtk::IconView::get_path_at_pos() shouldn't return invalid Gtk::TreePath
Gtk::IconView::get_path_at_pos() shouldn't return invalid Gtk::TreePath
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
unspecified
Other All
: Normal minor
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2009-02-03 21:55 UTC by Stef Walter
Modified: 2009-02-06 03:56 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Stef Walter 2009-02-03 21:55:19 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.
Comment 1 Murray Cumming 2009-02-05 17:25:54 UTC
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().

Comment 2 Stef Walter 2009-02-06 03:56:26 UTC
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. :)