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 93629 - expander animation doesn't always finish (bottom of the bug)
expander animation doesn't always finish (bottom of the bug)
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
2.0.x
Other All
: Normal major
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks: 97233
 
 
Reported: 2002-09-19 05:36 UTC by Hans Petter Jansson
Modified: 2011-02-04 16:11 UTC
See Also:
GNOME target: ---
GNOME version: 2.0


Attachments
Test case that should readily provoke the bug. (3.15 KB, text/plain)
2002-09-19 05:38 UTC, Hans Petter Jansson
  Details
possible fix (3.36 KB, patch)
2002-10-03 00:07 UTC, Kristian Rietveld
none Details | Review
Bad expander (12.24 KB, image/png)
2002-10-03 21:43 UTC, Hans Petter Jansson
  Details
Bad expander, children not shown (10.27 KB, image/png)
2002-10-03 21:44 UTC, Hans Petter Jansson
  Details

Description Hans Petter Jansson 2002-09-19 05:36:17 UTC
I have a GtkTreeStore where elements are changed after insertion. If I
assign the model as a child of GtkTreeModelSort, and sort on a column that
changes, it results in unpredictable behaviour and several warnings:

Gtk-CRITICAL **: file gtktreeview.c: line 3845 (validate_visible_area):
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.

Gtk-CRITICAL **: file gtktreestore.c: line 619 (gtk_tree_store_get_value):
assertion `iter->stamp == GTK_TREE_STORE (tree_model)->stamp' failed

Gtk-CRITICAL **: file gtktreemodelsort.c: line 1171
(gtk_tree_model_sort_real_unref_node): assertion `elt->ref_count > 0' failed

The last warning is also produced if the child is a GtkListStore.

* Steps to provoke this: Compile the attached source file with

cc `pkg-config --cflags --libs gtk+-2.0` -o gtk2-bug gtk2-bug.c

and run it. Sort on the column named "Sort Me". Expand some nodes and click
on their children. The test case is based on a test attached to another
(slightly confused IMHO) bug report.

* Background: I'm using GtkTreeStore and GtkListStore in the test case -
the model I actually want to use with GtkTreeModelSort is my own, and I
didn't want my own bugs to interfere with the test. However, this means I
would have to implement a sortable interface to that model and do the
sorting myself to work around this bug, which is hard, since the data nodes
are not owned by my GtkTreeModel, but a lower layer that does not depend on
GTK. In practice it would be another GtkTreeModelSort-alike implementation.

* Free ice cream for whoever fixes this. I'm not familiar enough with the
source myself, and it warns me of dangers to my pets.
Comment 1 Hans Petter Jansson 2002-09-19 05:38:54 UTC
Created attachment 11169 [details]
Test case that should readily provoke the bug.
Comment 2 Kristian Rietveld 2002-10-03 00:06:48 UTC
Oh man what a bug (: It took a while to find out what's wrong. I think
the attached patch fixes the problem.

Could you verify if this patch really fixes the problem (just to be
sure)? If so I can get it into gtk+ cvs ASAP.

(the patch is against gtk+ HEAD, but I think it will apply cleanly to
2-0 too).
Comment 3 Kristian Rietveld 2002-10-03 00:07:18 UTC
Created attachment 11370 [details] [review]
possible fix
Comment 4 Hans Petter Jansson 2002-10-03 21:42:31 UTC
Works perfectly for me. Thanks!

I'd like to mention a side effect, though. I don't think this is a bug
in GtkTreeModelSort - it could be in GtkTreeView itself:

When I click an expander, and the item moves before expanding fully,
it gets frozen in the state it was in when moved. This means that the
expander will be forever drawn at a bad rotation angle, and that if
the child items were not shown before the reorder occurred, they won't
be shown at all. The test program is the same.

I'm attaching two test images to show these cases. It's not a critical
bug to me, so do whatever you like with it - change the bug if it's in
another component etc.
Comment 5 Hans Petter Jansson 2002-10-03 21:43:29 UTC
Created attachment 11388 [details]
Bad expander
Comment 6 Hans Petter Jansson 2002-10-03 21:44:13 UTC
Created attachment 11389 [details]
Bad expander, children not shown
Comment 7 Kristian Rietveld 2002-10-14 22:54:53 UTC
committed the modelsort fix on HEAD. Will prolly commit it on stable
too later on.

Not sure yet how to fix your second bug.
Comment 8 Kristian Rietveld 2002-12-19 02:44:48 UTC
Moving remaining bugs to 2.2.1.
Comment 9 Kristian Rietveld 2003-01-14 22:47:16 UTC
Fixed the bad expander issue on HEAD, gtk-2-2.