diff options
author | Kristian Rietveld <kris@gtk.org> | 2002-04-17 22:26:44 +0000 |
---|---|---|
committer | Kristian Rietveld <kristian@src.gnome.org> | 2002-04-17 22:26:44 +0000 |
commit | a3045c84efae261c03ddde84df7f4ecf03a4c97b (patch) | |
tree | 1a49e0e076b4f5c133337710b330300618208df2 /gtk/gtktreemodelsort.c | |
parent | 9d03f7d62215379670853248f53be4ae1ec1d120 (diff) | |
download | gtk+-a3045c84efae261c03ddde84df7f4ecf03a4c97b.tar.gz |
so this function was completely broken. Fix it and improve readability.
Thu Apr 18 00:23:31 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreemodelsort.c
(gtk_tree_model_sort_convert_path_to_child_path): so this function
was completely broken. Fix it and improve readability.
Diffstat (limited to 'gtk/gtktreemodelsort.c')
-rw-r--r-- | gtk/gtktreemodelsort.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c index 038251d5b8..fb6aee381e 100644 --- a/gtk/gtktreemodelsort.c +++ b/gtk/gtktreemodelsort.c @@ -1964,19 +1964,26 @@ gtk_tree_model_sort_convert_path_to_child_path (GtkTreeModelSort *tree_model_sor for (i = 0; i < gtk_tree_path_get_depth (sorted_path); i++) { + gint count = sorted_indices[i]; + if ((level == NULL) || - (level->array->len <= sorted_indices[i])) + (level->array->len <= count)) { gtk_tree_path_free (retval); return NULL; } - if (g_array_index (level->array, SortElt, sorted_indices[i]).children == NULL) - gtk_tree_model_sort_build_level (tree_model_sort, level, &g_array_index (level->array, SortElt, sorted_indices[i])); + + if (g_array_index (level->array, SortElt, count).children == NULL) + gtk_tree_model_sort_build_level (tree_model_sort, level, &g_array_index (level->array, SortElt, count)); if (level == NULL) - break; + { + gtk_tree_path_free (retval); + break; + } - gtk_tree_path_append_index (retval, g_array_index (level->array, SortElt, i).offset); + gtk_tree_path_append_index (retval, g_array_index (level->array, SortElt, count).offset); + level = g_array_index (level->array, SortElt, count).children; } return retval; |