fix evil ref bug where the wrong row and a deleted row was unreffed. Found

Fri Feb  8 21:25:56 2002  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_deleted): fix
	evil ref bug where the wrong row and a deleted row was unreffed.
	Found by Darin Adler <darin@bentspoon.com>
This commit is contained in:
Jonathan Blandford 2002-02-09 01:28:00 +00:00 committed by Jonathan Blandford
parent 7b79dfbef8
commit d243e3ec4a
10 changed files with 69 additions and 8 deletions

View File

@ -1,3 +1,9 @@
Fri Feb 8 21:25:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_deleted): fix
evil ref bug where the wrong row and a deleted row was unreffed.
Found by Darin Adler <darin@bentspoon.com>
Fri Feb 8 18:46:13 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbindings.[ch] (_gtk_binding_reset_parsed): Add

View File

@ -1,3 +1,9 @@
Fri Feb 8 21:25:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_deleted): fix
evil ref bug where the wrong row and a deleted row was unreffed.
Found by Darin Adler <darin@bentspoon.com>
Fri Feb 8 18:46:13 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbindings.[ch] (_gtk_binding_reset_parsed): Add

View File

@ -1,3 +1,9 @@
Fri Feb 8 21:25:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_deleted): fix
evil ref bug where the wrong row and a deleted row was unreffed.
Found by Darin Adler <darin@bentspoon.com>
Fri Feb 8 18:46:13 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbindings.[ch] (_gtk_binding_reset_parsed): Add

View File

@ -1,3 +1,9 @@
Fri Feb 8 21:25:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_deleted): fix
evil ref bug where the wrong row and a deleted row was unreffed.
Found by Darin Adler <darin@bentspoon.com>
Fri Feb 8 18:46:13 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbindings.[ch] (_gtk_binding_reset_parsed): Add

View File

@ -1,3 +1,9 @@
Fri Feb 8 21:25:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_deleted): fix
evil ref bug where the wrong row and a deleted row was unreffed.
Found by Darin Adler <darin@bentspoon.com>
Fri Feb 8 18:46:13 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbindings.[ch] (_gtk_binding_reset_parsed): Add

View File

@ -1,3 +1,9 @@
Fri Feb 8 21:25:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_deleted): fix
evil ref bug where the wrong row and a deleted row was unreffed.
Found by Darin Adler <darin@bentspoon.com>
Fri Feb 8 18:46:13 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbindings.[ch] (_gtk_binding_reset_parsed): Add

View File

@ -1,3 +1,9 @@
Fri Feb 8 21:25:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_deleted): fix
evil ref bug where the wrong row and a deleted row was unreffed.
Found by Darin Adler <darin@bentspoon.com>
Fri Feb 8 18:46:13 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbindings.[ch] (_gtk_binding_reset_parsed): Add

View File

@ -71,6 +71,9 @@ GtkListStore *gtk_list_store_newv (gint n_columns,
void gtk_list_store_set_column_types (GtkListStore *list_store,
gint n_columns,
GType *types);
/* NOTE: use gtk_tree_model_get to get values from a GtkListStore */
void gtk_list_store_set_value (GtkListStore *list_store,
GtkTreeIter *iter,
gint column,

View File

@ -168,6 +168,9 @@ static gboolean gtk_tree_model_sort_iter_parent (GtkTreeModel
GtkTreeIter *child);
static void gtk_tree_model_sort_ref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static void gtk_tree_model_sort_real_unref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gboolean propagate_unref);
static void gtk_tree_model_sort_unref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter);
@ -686,21 +689,22 @@ gtk_tree_model_sort_row_deleted (GtkTreeModel *s_model,
elt = SORT_ELT (iter.user_data2);
offset = elt->offset;
gtk_tree_model_sort_increment_stamp (tree_model_sort);
gtk_tree_model_row_deleted (GTK_TREE_MODEL (data), path);
while (elt->ref_count > 0)
gtk_tree_model_sort_unref_node (GTK_TREE_MODEL (data), &iter);
gtk_tree_model_sort_real_unref_node (GTK_TREE_MODEL (data), &iter, FALSE);
if (level->ref_count == 0 && level != tree_model_sort->root)
{
/* This will prune the level, so I can just emit the signal and not worry
* about cleaning this level up. */
gtk_tree_model_sort_increment_stamp (tree_model_sort);
gtk_tree_model_row_deleted (GTK_TREE_MODEL (data), path);
gtk_tree_path_free (path);
return;
}
gtk_tree_model_sort_increment_stamp (tree_model_sort);
gtk_tree_model_row_deleted (GTK_TREE_MODEL (data), path);
/* Remove the row */
for (i = 0; i < level->array->len; i++)
if (elt->offset == g_array_index (level->array, SortElt, i).offset)
@ -1131,8 +1135,9 @@ gtk_tree_model_sort_ref_node (GtkTreeModel *tree_model,
}
static void
gtk_tree_model_sort_unref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter)
gtk_tree_model_sort_real_unref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gboolean propagate_unref)
{
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) tree_model;
GtkTreeIter child_iter;
@ -1145,7 +1150,8 @@ gtk_tree_model_sort_unref_node (GtkTreeModel *tree_model,
GET_CHILD_ITER (tree_model, &child_iter, iter);
gtk_tree_model_unref_node (GTK_TREE_MODEL_SORT (tree_model)->child_model, &child_iter);
if (propagate_unref)
gtk_tree_model_unref_node (GTK_TREE_MODEL_SORT (tree_model)->child_model, &child_iter);
level = iter->user_data;
elt = iter->user_data2;
@ -1171,6 +1177,13 @@ gtk_tree_model_sort_unref_node (GtkTreeModel *tree_model,
}
}
static void
gtk_tree_model_sort_unref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
gtk_tree_model_sort_real_unref_node (tree_model, iter, TRUE);
}
/* Sortable interface */
static gboolean
gtk_tree_model_sort_get_sort_column_id (GtkTreeSortable *sortable,

View File

@ -70,6 +70,9 @@ GtkTreeStore *gtk_tree_store_newv (gint n_columns,
void gtk_tree_store_set_column_types (GtkTreeStore *tree_store,
gint n_columns,
GType *types);
/* NOTE: use gtk_tree_model_get to get values from a GtkTreeStore */
void gtk_tree_store_set_value (GtkTreeStore *tree_store,
GtkTreeIter *iter,
gint column,