mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
added checks to ensure that the iter is not reordered to its own position.
2003-04-14 Michael Natterer <mitch@gimp.org> * gtk/gtkliststore.c (gtk_list_store_move): added checks to ensure that the iter is not reordered to its own position. Prevents model corruption for the case that the store contains only a single item (fixes bug #108387). Unrelated: * gtk/gtkliststore.c (gtk_list_store_insert): g_list_alloc() the new list element later so we don't leak it if we decide to return early. * gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node): set selection->tree_view->priv->anchor to NULL after freeing it.
This commit is contained in:
parent
9f53ec5d3b
commit
b45f8ef250
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
||||
2003-04-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_move): added checks to ensure
|
||||
that the iter is not reordered to its own position. Prevents model
|
||||
corruption for the case that the store contains only a single item
|
||||
(fixes bug #108387).
|
||||
|
||||
Unrelated:
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_insert): g_list_alloc() the
|
||||
new list element later so we don't leak it if we decide to return
|
||||
early.
|
||||
|
||||
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||
set selection->tree_view->priv->anchor to NULL after freeing it.
|
||||
|
||||
2003-04-13 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c
|
||||
|
@ -1,3 +1,19 @@
|
||||
2003-04-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_move): added checks to ensure
|
||||
that the iter is not reordered to its own position. Prevents model
|
||||
corruption for the case that the store contains only a single item
|
||||
(fixes bug #108387).
|
||||
|
||||
Unrelated:
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_insert): g_list_alloc() the
|
||||
new list element later so we don't leak it if we decide to return
|
||||
early.
|
||||
|
||||
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||
set selection->tree_view->priv->anchor to NULL after freeing it.
|
||||
|
||||
2003-04-13 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c
|
||||
|
@ -1,3 +1,19 @@
|
||||
2003-04-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_move): added checks to ensure
|
||||
that the iter is not reordered to its own position. Prevents model
|
||||
corruption for the case that the store contains only a single item
|
||||
(fixes bug #108387).
|
||||
|
||||
Unrelated:
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_insert): g_list_alloc() the
|
||||
new list element later so we don't leak it if we decide to return
|
||||
early.
|
||||
|
||||
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||
set selection->tree_view->priv->anchor to NULL after freeing it.
|
||||
|
||||
2003-04-13 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c
|
||||
|
@ -1,3 +1,19 @@
|
||||
2003-04-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_move): added checks to ensure
|
||||
that the iter is not reordered to its own position. Prevents model
|
||||
corruption for the case that the store contains only a single item
|
||||
(fixes bug #108387).
|
||||
|
||||
Unrelated:
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_insert): g_list_alloc() the
|
||||
new list element later so we don't leak it if we decide to return
|
||||
early.
|
||||
|
||||
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||
set selection->tree_view->priv->anchor to NULL after freeing it.
|
||||
|
||||
2003-04-13 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c
|
||||
|
@ -1,3 +1,19 @@
|
||||
2003-04-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_move): added checks to ensure
|
||||
that the iter is not reordered to its own position. Prevents model
|
||||
corruption for the case that the store contains only a single item
|
||||
(fixes bug #108387).
|
||||
|
||||
Unrelated:
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_insert): g_list_alloc() the
|
||||
new list element later so we don't leak it if we decide to return
|
||||
early.
|
||||
|
||||
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||
set selection->tree_view->priv->anchor to NULL after freeing it.
|
||||
|
||||
2003-04-13 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c
|
||||
|
@ -1088,8 +1088,6 @@ gtk_list_store_insert (GtkListStore *list_store,
|
||||
return;
|
||||
}
|
||||
|
||||
new_list = g_slist_alloc ();
|
||||
|
||||
list = g_slist_nth (G_SLIST (list_store->root), position - 1);
|
||||
|
||||
if (list == NULL)
|
||||
@ -1100,6 +1098,8 @@ gtk_list_store_insert (GtkListStore *list_store,
|
||||
return;
|
||||
}
|
||||
|
||||
new_list = g_slist_alloc ();
|
||||
|
||||
insert_after (list_store, list, new_list);
|
||||
|
||||
iter->stamp = list_store->stamp;
|
||||
@ -1802,7 +1802,7 @@ gtk_list_store_move (GtkListStore *store,
|
||||
GtkTreeIter dst_a;
|
||||
GSList *i, *a, *prev = NULL, *tmp;
|
||||
gint new_pos = 0, old_pos = 0, j = 0, *order;
|
||||
GtkTreePath *path, *pos_path = NULL;
|
||||
GtkTreePath *path = NULL, *pos_path = NULL;
|
||||
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (store));
|
||||
g_return_if_fail (!GTK_LIST_STORE_IS_SORTED (store));
|
||||
@ -1836,6 +1836,7 @@ gtk_list_store_move (GtkListStore *store,
|
||||
goto free_paths_and_out;
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
/* getting destination iters */
|
||||
@ -1863,6 +1864,23 @@ gtk_list_store_move (GtkListStore *store,
|
||||
a = NULL;
|
||||
}
|
||||
|
||||
/* don't try to reorder the iter to it's own position */
|
||||
if (a)
|
||||
{
|
||||
if (a == iter->user_data)
|
||||
goto free_paths_and_out;
|
||||
}
|
||||
else if (before)
|
||||
{
|
||||
if (iter->user_data == store->tail)
|
||||
goto free_paths_and_out;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iter->user_data == store->root)
|
||||
goto free_paths_and_out;
|
||||
}
|
||||
|
||||
/* getting the old prev node */
|
||||
if (iter->user_data == store->root)
|
||||
prev = NULL;
|
||||
@ -1967,8 +1985,10 @@ gtk_list_store_move (GtkListStore *store,
|
||||
return;
|
||||
|
||||
free_paths_and_out:
|
||||
gtk_tree_path_free (path);
|
||||
gtk_tree_path_free (pos_path);
|
||||
if (path)
|
||||
gtk_tree_path_free (path);
|
||||
if (pos_path)
|
||||
gtk_tree_path_free (pos_path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1348,7 +1348,11 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
|
||||
if (dirty)
|
||||
{
|
||||
if (selection->tree_view->priv->anchor)
|
||||
gtk_tree_row_reference_free (selection->tree_view->priv->anchor);
|
||||
{
|
||||
gtk_tree_row_reference_free (selection->tree_view->priv->anchor);
|
||||
selection->tree_view->priv->anchor = NULL;
|
||||
}
|
||||
|
||||
if (gtk_tree_selection_real_select_node (selection, tree, node, TRUE))
|
||||
{
|
||||
selection->tree_view->priv->anchor =
|
||||
|
Loading…
Reference in New Issue
Block a user