diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 16 | ||||
-rw-r--r-- | gtk/gtkliststore.c | 30 | ||||
-rw-r--r-- | gtk/gtktreeselection.c | 6 |
7 files changed, 110 insertions, 6 deletions
@@ -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 diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 97a45ab3fa..dda362153e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -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 diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 97a45ab3fa..dda362153e 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -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 diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 97a45ab3fa..dda362153e 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -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 diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 97a45ab3fa..dda362153e 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -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 diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c index 74e52e08d8..28c4bbd891 100644 --- a/gtk/gtkliststore.c +++ b/gtk/gtkliststore.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); } /** diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c index f2fe18bb28..424ba9c9ae 100644 --- a/gtk/gtktreeselection.c +++ b/gtk/gtktreeselection.c @@ -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 = |