[gtk+] treeview: Add a CURSOR_INVALID flag to set_cursor_row()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] treeview: Add a CURSOR_INVALID flag to set_cursor_row()
- Date: Sat, 10 Dec 2011 07:01:36 +0000 (UTC)
commit 559c3c7da1e7d63de0768ee2cd9cec2bf3daf437
Author: Benjamin Otte <otte redhat com>
Date: Sat Dec 10 06:10:05 2011 +0100
treeview: Add a CURSOR_INVALID flag to set_cursor_row()
This is necessary so the code doesn't attempt to do things with the
previous cursor, which currently cause crashes.
gtk/gtktreeview.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 0f1ec77..c8a1438 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -154,7 +154,8 @@ enum
typedef enum {
CLEAR_AND_SELECT = (1 << 0),
- CLAMP_NODE = (1 << 1)
+ CLAMP_NODE = (1 << 1),
+ CURSOR_INVALID = (1 << 2)
} SetCursorFlags;
/* This lovely little value is used to determine how far away from the title bar
@@ -9098,12 +9099,11 @@ gtk_tree_view_row_deleted (GtkTreeModel *model,
if (cursor_node)
{
GtkTreePath *cursor_path = _gtk_tree_path_new_from_rbtree (cursor_tree, cursor_node);
- tree_view->priv->cursor_node = NULL;
- gtk_tree_view_real_set_cursor (tree_view, cursor_path, CLEAR_AND_SELECT);
+ gtk_tree_view_real_set_cursor (tree_view, cursor_path, CLEAR_AND_SELECT | CURSOR_INVALID);
gtk_tree_path_free (cursor_path);
}
else
- gtk_tree_view_real_set_cursor (tree_view, NULL, CLEAR_AND_SELECT);
+ gtk_tree_view_real_set_cursor (tree_view, NULL, CLEAR_AND_SELECT | CURSOR_INVALID);
}
else if (selection_changed)
g_signal_emit_by_name (tree_view->priv->selection, "changed");
@@ -12911,7 +12911,7 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
/* if we change the cursor, we also change the selection,
* so no need to emit selection-changed. */
if (cursor_changed)
- gtk_tree_view_real_set_cursor (tree_view, path, CLEAR_AND_SELECT);
+ gtk_tree_view_real_set_cursor (tree_view, path, CLEAR_AND_SELECT | CURSOR_INVALID);
else if (selection_changed)
g_signal_emit_by_name (tree_view->priv->selection, "changed");
@@ -13162,7 +13162,7 @@ gtk_tree_view_real_set_cursor (GtkTreeView *tree_view,
GtkTreePath *path,
SetCursorFlags flags)
{
- if (tree_view->priv->cursor_node)
+ if (!(flags & CURSOR_INVALID) && tree_view->priv->cursor_node)
{
_gtk_tree_view_queue_draw_node (tree_view,
tree_view->priv->cursor_tree,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]