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 539377 - Unnecessary warnings when GtkTreeView is not realized.
Unnecessary warnings when GtkTreeView is not realized.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
unspecified
Other Linux
: Normal minor
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2008-06-20 21:43 UTC by Björn Lindqvist
Modified: 2009-07-30 12:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Suggested fix, return FALSE instead of warning if not realized (1.10 KB, patch)
2008-10-06 21:11 UTC, Björn Lindqvist
none Details | Review

Description Björn Lindqvist 2008-06-20 21:43:03 UTC
gtk_tree_view_get_path_at_pos() and gtk_tree_view_get_dest_row_at_pos() fails with a GtkWarning if bin_window is NULL:

    GtkWarning: gtk_tree_view_get_path_at_pos: assertion `tree_view->priv->bin_window != NULL' failed

That's not entirely wrong since the functions doesn't work if the GtkTreeView isn't realized. But the warnings aren't needed, instead of failing with:

    g_return_val_if_fail (tree_view->priv->bin_window != NULL, FALSE);

The could could just check if there is a bin_window and return FALSE if not:

    if (!tree_view->priv->bin_window)
        return FALSE;

That would be more consistent with how the model attribute is checked for.
Comment 1 Björn Lindqvist 2008-10-06 21:11:42 UTC
Created attachment 120055 [details] [review]
Suggested fix, return FALSE instead of warning if not realized
Comment 2 Matthias Clasen 2008-10-06 22:07:58 UTC
At least for gtk_tree_view_get_path_at_pos, the docs make it pretty explicit that calling it on a non-realized treeview is a programming error. 
Comment 3 Björn Lindqvist 2008-10-06 22:48:58 UTC
I explained it badly. Calling gtk_tree_view_get_path_at_pos when you have no model OR when it is not realized is the same kind of error. The function call doesn't make sense in either situation. So it would be better if both those cases were treated the same way. But they aren't which is inconsistent.
Comment 4 Kristian Rietveld 2009-07-30 12:25:22 UTC
I agree with Bjorn.  I've extended the patch to also cover get_drag_dest_row(), added a unit test and committed.