Print failed assertions for failed child iterator conversions

This commit is contained in:
Kristian Rietveld 2011-05-09 10:04:24 +02:00
parent 2f5fbcd10a
commit f0da89fa20
2 changed files with 30 additions and 5 deletions

View File

@ -151,8 +151,17 @@ enum
PROP_VIRTUAL_ROOT
};
#define GTK_TREE_MODEL_FILTER_CACHE_CHILD_ITERS(filter) \
/* Set this to 0 to disable caching of child iterators. This
* allows for more stringent testing. It is recommended to set this
* to one when refactoring this code and running the unit tests to
* catch more errors.
*/
#if 1
# define GTK_TREE_MODEL_FILTER_CACHE_CHILD_ITERS(filter) \
(((GtkTreeModelFilter *)filter)->priv->child_flags & GTK_TREE_MODEL_ITERS_PERSIST)
#else
# define GTK_TREE_MODEL_FILTER_CACHE_CHILD_ITERS(filter) (FALSE)
#endif
#define FILTER_ELT(filter_elt) ((FilterElt *)filter_elt)
#define FILTER_LEVEL(filter_level) ((FilterLevel *)filter_level)
@ -3330,12 +3339,16 @@ gtk_tree_model_filter_convert_iter_to_child_iter (GtkTreeModelFilter *filter,
else
{
GtkTreePath *path;
gboolean valid = FALSE;
path = gtk_tree_model_filter_elt_get_path (filter_iter->user_data,
filter_iter->user_data2,
filter->priv->virtual_root);
gtk_tree_model_get_iter (filter->priv->child_model, child_iter, path);
valid = gtk_tree_model_get_iter (filter->priv->child_model, child_iter,
path);
gtk_tree_path_free (path);
g_return_if_fail (valid == TRUE);
}
}

View File

@ -228,9 +228,18 @@ struct _GtkTreeModelSortPrivate
gulong reordered_id;
};
#define GTK_TREE_MODEL_SORT_CACHE_CHILD_ITERS(tree_model_sort) \
/* Set this to 0 to disable caching of child iterators. This
* allows for more stringent testing. It is recommended to set this
* to one when refactoring this code and running the unit tests to
* catch more errors.
*/
#if 1
# define GTK_TREE_MODEL_SORT_CACHE_CHILD_ITERS(tree_model_sort) \
(((GtkTreeModelSort *)tree_model_sort)->priv->child_flags&GTK_TREE_MODEL_ITERS_PERSIST)
#else
# define GTK_TREE_MODEL_SORT_CACHE_CHILD_ITERS(tree_model_sort) (FALSE)
#endif
#define SORT_ELT(sort_elt) ((SortElt *)sort_elt)
#define SORT_LEVEL(sort_level) ((SortLevel *)sort_level)
@ -2422,11 +2431,14 @@ gtk_tree_model_sort_convert_iter_to_child_iter (GtkTreeModelSort *tree_model_sor
else
{
GtkTreePath *path;
gboolean valid = FALSE;
path = gtk_tree_model_sort_elt_get_path (sorted_iter->user_data,
sorted_iter->user_data2);
gtk_tree_model_get_iter (priv->child_model, child_iter, path);
valid = gtk_tree_model_get_iter (priv->child_model, child_iter, path);
gtk_tree_path_free (path);
g_return_if_fail (valid == TRUE);
}
}