[gtk+] Bug 498010, 546005 - fix assertion in gtk_tree_view_set_cursor_on_cell
- From: Kristian Rietveld <kristian src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Bug 498010, 546005 - fix assertion in gtk_tree_view_set_cursor_on_cell
- Date: Thu, 30 Jul 2009 18:25:13 +0000 (UTC)
commit ff10f9ce0243a06d24e1319fa546d5a6e6d5eb69
Author: Kristian Rietveld <kris gtk org>
Date: Thu Jul 30 13:58:25 2009 +0200
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 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index eaf088d..b7a0a7e 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]