diff options
author | Kristian Rietveld <kris@gtk.org> | 2011-05-09 10:04:24 +0200 |
---|---|---|
committer | Kristian Rietveld <kris@gtk.org> | 2011-08-22 21:30:29 +0200 |
commit | f0da89fa2032060351d1987d445b04d07e90c04a (patch) | |
tree | cce1d6ef2327217762b39a499340335b7ec2fed5 /gtk/gtktreemodelsort.c | |
parent | 2f5fbcd10a4856d99d4e8a9a333a816e3035f625 (diff) | |
download | gtk+-f0da89fa2032060351d1987d445b04d07e90c04a.tar.gz |
Print failed assertions for failed child iterator conversions
Diffstat (limited to 'gtk/gtktreemodelsort.c')
-rw-r--r-- | gtk/gtktreemodelsort.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c index c5186125c0..9a59a802d3 100644 --- a/gtk/gtktreemodelsort.c +++ b/gtk/gtktreemodelsort.c @@ -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>K_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); } } |