gtk+ r19530 - in trunk: . gtk



Author: kristian
Date: Tue Feb 12 15:58:25 2008
New Revision: 19530
URL: http://svn.gnome.org/viewvc/gtk+?rev=19530&view=rev

Log:
2008-02-12  Kristian Rietveld  <kris imendio com>

	* gtk/gtktreeview.c (gtk_tree_view_real_select_cursor_row),
	(gtk_tree_view_real_toggle_cursor_row): guard against people
	deleting the row in question in the selection-changed callback.
	(#514621, Andreas Koehler).



Modified:
   trunk/ChangeLog
   trunk/gtk/gtktreeview.c

Modified: trunk/gtk/gtktreeview.c
==============================================================================
--- trunk/gtk/gtktreeview.c	(original)
+++ trunk/gtk/gtktreeview.c	Tue Feb 12 15:58:25 2008
@@ -10081,6 +10081,8 @@
 gtk_tree_view_real_select_cursor_row (GtkTreeView *tree_view,
 				      gboolean     start_editing)
 {
+  GtkRBTree *new_tree = NULL;
+  GtkRBNode *new_node = NULL;
   GtkRBTree *cursor_tree = NULL;
   GtkRBNode *cursor_node = NULL;
   GtkTreePath *cursor_path = NULL;
@@ -10126,6 +10128,15 @@
                                             mode,
 					    FALSE);
 
+  /* We bail out if the original (tree, node) don't exist anymore after
+   * handling the selection-changed callback.  We do return TRUE because
+   * the key press has been handled at this point.
+   */
+  _gtk_tree_view_find_node (tree_view, cursor_path, &new_tree, &new_node);
+
+  if (cursor_tree != new_tree || cursor_node != new_node)
+    return FALSE;
+
   gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
 
   gtk_widget_grab_focus (GTK_WIDGET (tree_view));
@@ -10143,6 +10154,8 @@
 static gboolean
 gtk_tree_view_real_toggle_cursor_row (GtkTreeView *tree_view)
 {
+  GtkRBTree *new_tree = NULL;
+  GtkRBNode *new_node = NULL;
   GtkRBTree *cursor_tree = NULL;
   GtkRBNode *cursor_node = NULL;
   GtkTreePath *cursor_path = NULL;
@@ -10172,6 +10185,15 @@
                                             GTK_TREE_SELECT_MODE_TOGGLE,
 					    FALSE);
 
+  /* We bail out if the original (tree, node) don't exist anymore after
+   * handling the selection-changed callback.  We do return TRUE because
+   * the key press has been handled at this point.
+   */
+  _gtk_tree_view_find_node (tree_view, cursor_path, &new_tree, &new_node);
+
+  if (cursor_tree != new_tree || cursor_node != new_node)
+    return FALSE;
+
   gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
 
   gtk_widget_grab_focus (GTK_WIDGET (tree_view));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]