GNOME Bugzilla – Bug 539377
Unnecessary warnings when GtkTreeView is not realized.
Last modified: 2009-07-30 12:25:22 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.
Created attachment 120055 [details] [review] Suggested fix, return FALSE instead of warning if not realized
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.
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.
I agree with Bjorn. I've extended the patch to also cover get_drag_dest_row(), added a unit test and committed.