After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 153479 - liststore bug
liststore bug
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
: 155607 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-09-22 20:28 UTC by Christian Persch
Modified: 2011-02-04 16:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testcase (1.76 KB, text/plain)
2004-09-22 20:29 UTC, Christian Persch
Details

Description Christian Persch 2004-09-22 20:28:43 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.
Comment 1 Christian Persch 2004-09-22 20:29:05 UTC
Created attachment 31852 [details]
testcase
Comment 2 Soren Sandmann Pedersen 2004-09-22 20:55:59 UTC
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).
Comment 3 Matthias Clasen 2004-09-25 04:48:17 UTC
Soeren, I think you *are* supposed to emit reordered. Look at what
gtk_list_store_swap() does in 2.4
Comment 4 Matthias Clasen 2004-09-25 04:50:32 UTC
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...
Comment 5 Soren Sandmann Pedersen 2004-10-23 19:29:47 UTC
*** Bug 155607 has been marked as a duplicate of this bug. ***
Comment 6 Soren Sandmann Pedersen 2004-10-23 20:25:49 UTC
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