GNOME Bugzilla – Bug 153479
liststore bug
Last modified: 2011-02-04 16:17:18 UTC
Steps to reproduce: 0) Compile the attached testcase with gtk+ HEAD. 1) Run it with gtk+ HEAD 2) Select "B" row 3) Click "Move Up" button 4) Move mouse over treeview Expected results: Move "B" row before "A" row. This works as expected on gtk-2-4. Actual results: Not moved. When moving over treeview, get those warnings on console: Gtk-CRITICAL **: file gtktreeview.c: line 3840 (gtk_tree_view_bin_expose): assertion `has_next' failed. There is a disparity between the internal view of the GtkTreeView, and the GtkTreeModel. This generally means that the model has changed without letting the view know. Any display from now on is likely to be incorrect.
Created attachment 31852 [details] testcase
gtk_list_store_swap() informs the tree view that it has changed the rows with this code: gtk_tree_model_row_changed (GTK_TREE_MODEL (store), path, a); gtk_tree_model_row_changed (GTK_TREE_MODEL (store), path, b); but it doesn't look like the gtk_tree_view_row_changed() considers "row changed" to mean "might have changed position". I hope that you are not supposed to emit the "reordered" signal whenever a row may have changed position because that signal takes time O(n) to emit ... (And it would mean the nautilus list model is broken too).
Soeren, I think you *are* supposed to emit reordered. Look at what gtk_list_store_swap() does in 2.4
It would be much better to put only the actually changed indices in the order array, ie omit all entries where old_pos = new_pos, but that would be an incompatible change...
*** Bug 155607 has been marked as a duplicate of this bug. ***
I have filed bug 156244 about making operations like this more efficient. Sat Oct 23 16:07:46 2004 Søren Sandmann <sandmann@redhat.com> * gtk/gtksequence.c (_gtk_sequence_swap): Replace broken, overly clever implementation with one that works. * gtk/gtkliststore.c (gtk_list_store_swap): emit "rows_reordered" instead of "changed" twice. Bug 153479