From f0c42465b9b5f9489fb3ae548233911ef6310167 Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Tue, 22 Jan 2002 00:21:40 +0000 Subject: [PATCH] add some more stamp checks (pointed out by Anders Carlsson) Mon Jan 21 01:21:54 2002 Kristian Rietveld * gtk/gtktreestore.c: add some more stamp checks (pointed out by Anders Carlsson) * gtk/gtktreemodelsort.c (gtk_tree_model_sort_insert_value): don't assume _row_changed will insert sort (because _row_changed doesn't need to follow this signal), so apply insert sort here (gtk_tree_model_sort_level_find_insert): header doesn't need to be set here, so use a return instead of g_return_val_if_fail. --- ChangeLog | 11 +++++++++++ ChangeLog.pre-2-0 | 11 +++++++++++ ChangeLog.pre-2-10 | 11 +++++++++++ ChangeLog.pre-2-2 | 11 +++++++++++ ChangeLog.pre-2-4 | 11 +++++++++++ ChangeLog.pre-2-6 | 11 +++++++++++ ChangeLog.pre-2-8 | 11 +++++++++++ gtk/gtktreemodelsort.c | 11 ++++++----- gtk/gtktreestore.c | 10 ++++++++-- 9 files changed, 91 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 630283ff9c..3958894687 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Mon Jan 21 01:21:54 2002 Kristian Rietveld + + * gtk/gtktreestore.c: add some more stamp checks (pointed out + by Anders Carlsson) + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_insert_value): don't + assume _row_changed will insert sort (because _row_changed doesn't + need to follow this signal), so apply insert sort here + (gtk_tree_model_sort_level_find_insert): header doesn't need to be + set here, so use a return instead of g_return_val_if_fail. + Mon Jan 21 18:28:17 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_adjustment_changed): Update diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 630283ff9c..3958894687 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,14 @@ +Mon Jan 21 01:21:54 2002 Kristian Rietveld + + * gtk/gtktreestore.c: add some more stamp checks (pointed out + by Anders Carlsson) + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_insert_value): don't + assume _row_changed will insert sort (because _row_changed doesn't + need to follow this signal), so apply insert sort here + (gtk_tree_model_sort_level_find_insert): header doesn't need to be + set here, so use a return instead of g_return_val_if_fail. + Mon Jan 21 18:28:17 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_adjustment_changed): Update diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 630283ff9c..3958894687 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +Mon Jan 21 01:21:54 2002 Kristian Rietveld + + * gtk/gtktreestore.c: add some more stamp checks (pointed out + by Anders Carlsson) + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_insert_value): don't + assume _row_changed will insert sort (because _row_changed doesn't + need to follow this signal), so apply insert sort here + (gtk_tree_model_sort_level_find_insert): header doesn't need to be + set here, so use a return instead of g_return_val_if_fail. + Mon Jan 21 18:28:17 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_adjustment_changed): Update diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 630283ff9c..3958894687 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,14 @@ +Mon Jan 21 01:21:54 2002 Kristian Rietveld + + * gtk/gtktreestore.c: add some more stamp checks (pointed out + by Anders Carlsson) + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_insert_value): don't + assume _row_changed will insert sort (because _row_changed doesn't + need to follow this signal), so apply insert sort here + (gtk_tree_model_sort_level_find_insert): header doesn't need to be + set here, so use a return instead of g_return_val_if_fail. + Mon Jan 21 18:28:17 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_adjustment_changed): Update diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 630283ff9c..3958894687 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,14 @@ +Mon Jan 21 01:21:54 2002 Kristian Rietveld + + * gtk/gtktreestore.c: add some more stamp checks (pointed out + by Anders Carlsson) + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_insert_value): don't + assume _row_changed will insert sort (because _row_changed doesn't + need to follow this signal), so apply insert sort here + (gtk_tree_model_sort_level_find_insert): header doesn't need to be + set here, so use a return instead of g_return_val_if_fail. + Mon Jan 21 18:28:17 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_adjustment_changed): Update diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 630283ff9c..3958894687 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +Mon Jan 21 01:21:54 2002 Kristian Rietveld + + * gtk/gtktreestore.c: add some more stamp checks (pointed out + by Anders Carlsson) + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_insert_value): don't + assume _row_changed will insert sort (because _row_changed doesn't + need to follow this signal), so apply insert sort here + (gtk_tree_model_sort_level_find_insert): header doesn't need to be + set here, so use a return instead of g_return_val_if_fail. + Mon Jan 21 18:28:17 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_adjustment_changed): Update diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 630283ff9c..3958894687 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +Mon Jan 21 01:21:54 2002 Kristian Rietveld + + * gtk/gtktreestore.c: add some more stamp checks (pointed out + by Anders Carlsson) + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_insert_value): don't + assume _row_changed will insert sort (because _row_changed doesn't + need to follow this signal), so apply insert sort here + (gtk_tree_model_sort_level_find_insert): header doesn't need to be + set here, so use a return instead of g_return_val_if_fail. + Mon Jan 21 18:28:17 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_adjustment_changed): Update diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c index 80243090ef..ca3cc72b71 100644 --- a/gtk/gtktreemodelsort.c +++ b/gtk/gtktreemodelsort.c @@ -1581,7 +1581,9 @@ gtk_tree_model_sort_level_find_insert (GtkTreeModelSort *tree_model_sort, header = _gtk_tree_data_list_get_header (tree_model_sort->sort_list, tree_model_sort->sort_column_id); - g_return_val_if_fail (header != NULL, 0); + if (!header) + return 0; + g_return_val_if_fail (header->func != NULL, 0); func = header->func; @@ -1634,11 +1636,10 @@ gtk_tree_model_sort_insert_value (GtkTreeModelSort *tree_model_sort, elt.ref_count = 0; elt.children = NULL; - /* just insert it here, the ::row_changed signal will put the model - * back in a nice sort order - */ + index = gtk_tree_model_sort_level_find_insert (tree_model_sort, + level, s_iter, + FALSE); - index = gtk_tree_path_get_indices (s_path)[gtk_tree_path_get_depth (s_path)-1]; g_array_insert_vals (level->array, index, &elt, 1); /* update all larger offsets */ diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c index 751850aab7..3f08955325 100644 --- a/gtk/gtktreestore.c +++ b/gtk/gtktreestore.c @@ -612,6 +612,7 @@ gtk_tree_store_get_value (GtkTreeModel *tree_model, g_return_if_fail (GTK_IS_TREE_STORE (tree_model)); g_return_if_fail (iter != NULL); + g_return_if_fail (iter->stamp == GTK_TREE_STORE (tree_model)->stamp); g_return_if_fail (column < GTK_TREE_STORE (tree_model)->n_columns); list = G_NODE (iter->user_data)->data; @@ -636,7 +637,9 @@ static gboolean gtk_tree_store_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter) { + g_return_val_if_fail (iter != NULL, FALSE); g_return_val_if_fail (iter->user_data != NULL, FALSE); + g_return_val_if_fail (iter->stamp == GTK_TREE_STORE (tree_model)->stamp, FALSE); if (G_NODE (iter->user_data)->next) { @@ -655,6 +658,7 @@ gtk_tree_store_iter_children (GtkTreeModel *tree_model, GNode *children; g_return_val_if_fail (parent == NULL || parent->user_data != NULL, FALSE); + g_return_val_if_fail (parent->stamp == GTK_TREE_STORE (tree_model)->stamp, FALSE); if (parent) children = G_NODE (parent->user_data)->children; @@ -743,7 +747,9 @@ gtk_tree_store_iter_parent (GtkTreeModel *tree_model, GNode *parent; g_return_val_if_fail (iter != NULL, FALSE); - g_return_val_if_fail (iter->user_data != NULL, FALSE); + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (child->user_data != NULL, FALSE); + g_return_val_if_fail (child->stamp == GTK_TREE_STORE (tree_model)->stamp, FALSE); parent = G_NODE (child->user_data)->parent; @@ -1265,7 +1271,7 @@ gtk_tree_store_prepend (GtkTreeStore *tree_store, iter->stamp = tree_store->stamp; iter->user_data = g_node_new (NULL); - g_node_prepend (parent_node, iter->user_data); + g_node_prepend (parent_node, G_NODE (iter->user_data)); path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter); gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);