gtk+ r19531 - in branches/gtk-2-12: . gtk



Author: kristian
Date: Tue Feb 12 16:00:02 2008
New Revision: 19531
URL: http://svn.gnome.org/viewvc/gtk+?rev=19531&view=rev

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

	Merge from trunk:

	* 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:
   branches/gtk-2-12/ChangeLog
   branches/gtk-2-12/gtk/gtktreeview.c

Modified: branches/gtk-2-12/gtk/gtktreeview.c
==============================================================================
--- branches/gtk-2-12/gtk/gtktreeview.c	(original)
+++ branches/gtk-2-12/gtk/gtktreeview.c	Tue Feb 12 16:00:02 2008
@@ -10075,6 +10075,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;
@@ -10120,6 +10122,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));
@@ -10137,6 +10148,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;
@@ -10166,6 +10179,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]