We've had a few bug reports about list model crashers when changing the sort criterion, with expanded nested subdirectories. It turns out that the way gtk_tree_model_rows_reordered was invoked was only appropriate before we had path depths > 0. Proposed patch attached. I've decided to do an assert since looking up the iter really shouldn't fail. -- Christian Neumair <chris gnome-de org>
Index: src/file-manager/fm-list-model.c =================================================================== RCS file: /cvs/gnome/nautilus/src/file-manager/fm-list-model.c,v retrieving revision 1.44 diff -u -p -r1.44 fm-list-model.c --- src/file-manager/fm-list-model.c 6 Jul 2005 12:18:28 -0000 1.44 +++ src/file-manager/fm-list-model.c 1 Oct 2005 11:43:49 -0000 @@ -572,10 +572,12 @@ static void fm_list_model_sort_file_entries (FMListModel *model, GSequence *files, GtkTreePath *path) { GSequencePtr *old_order; + GtkTreeIter iter; int *new_order; int length; int i; FileEntry *file_entry; + gboolean has_iter; length = g_sequence_get_length (files); @@ -611,8 +613,15 @@ fm_list_model_sort_file_entries (FMListM /* Let the world know about our new order */ g_assert (new_order != NULL); + + has_iter = FALSE; + if (gtk_tree_path_get_depth (path) != 0) { + has_iter = TRUE; + g_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path)); + } + gtk_tree_model_rows_reordered (GTK_TREE_MODEL (model), - path, NULL, new_order); + path, has_iter ? &iter : NULL, new_order); g_free (old_order); g_free (new_order);
Attachment:
signature.asc
Description: This is a digitally signed message part