From ff10f9ce0243a06d24e1319fa546d5a6e6d5eb69 Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Thu, 30 Jul 2009 13:58:25 +0200 Subject: [PATCH] Bug 498010, 546005 - fix assertion in gtk_tree_view_set_cursor_on_cell Instead of failing with warning on !tree_view->priv->tree, return silently when tree_view->priv->model is NULL. Clarified in the documentation that for invalid paths (and every path is invalid when no model is set), the function will fail silently although the current cursor will be unset. Fixes bugs 498010 and 546005. --- gtk/gtktreeview.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index eaf088d70e..b7a0a7e283 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -12517,6 +12517,9 @@ gtk_tree_view_get_cursor (GtkTreeView *tree_view, * This function is often followed by @gtk_widget_grab_focus (@tree_view) * in order to give keyboard focus to the widget. Please note that editing * can only happen when the widget is realized. + * + * If @path is invalid for @model, the current cursor (if any) will be unset + * and the function will return without failing. **/ void gtk_tree_view_set_cursor (GtkTreeView *tree_view, @@ -12548,6 +12551,9 @@ gtk_tree_view_set_cursor (GtkTreeView *tree_view, * widget. Please note that editing can only happen when the widget is * realized. * + * If @path is invalid for @model, the current cursor (if any) will be unset + * and the function will return without failing. + * * Since: 2.2 **/ void @@ -12558,9 +12564,12 @@ gtk_tree_view_set_cursor_on_cell (GtkTreeView *tree_view, gboolean start_editing) { g_return_if_fail (GTK_IS_TREE_VIEW (tree_view)); - g_return_if_fail (tree_view->priv->tree != NULL); g_return_if_fail (path != NULL); g_return_if_fail (focus_column == NULL || GTK_IS_TREE_VIEW_COLUMN (focus_column)); + + if (!tree_view->priv->model) + return; + if (focus_cell) { g_return_if_fail (focus_column);