GNOME Bugzilla – Bug 138082
treeview crashes in fixed-height-mode.
Last modified: 2004-12-22 21:47:04 UTC
1) create treeview on a ListStore in fixed-height-mode 2) add items to the store 3) clear the store 4) add items again to the store Backtrace: Program received signal SIGSEGV, Segmentation fault.
+ Trace 45411
Thread 1024 (LWP 11675)
I am not sure, but shouldn't the newly inserted node be passed to _gtk_rb_tree_node_set_height(), instead of 'tmpnode'? Or maybe the fixed height shoud be reset to -1 when the rbTree gets empty?
I can reproduce this. Small test to trigger the segfault attached. Cheers -Tim
Created attachment 26009 [details] small program to trigger segfault
The following change fixes the problem for me. However, I don't really understand the code, so I can't say whether this is the right fix. Tested with the above GtkListStore example and a custom (list) tree model. gtktreeview.c: 6742 if (tree_view->priv->fixed_height_mode 6743 - && tree_view->priv->fixed_height >= 0) 6743 + && tree_view->priv->fixed_height >= 0 && tmpnode) 6744 _gtk_rbtree_node_set_height (tree, tmpnode, tree_view->priv->fixed_height); Cheers -Tim
The crash is reproducable for me too.
*** Bug 138685 has been marked as a duplicate of this bug. ***
attachment 26214 [details] in bug 138685 contains an even small testcase
Richard was offering beer, so I was sort of forced to look at this. My patch is attached. Test it, and then try to get jrb to look at it or something.
Created attachment 26252 [details] [review] proposed patch. The patch in 26009 doesn't fix the actual problem, but works around it. The fixed height is then never set on the new node.
The patch works for the simple testcase above. I haven't tried it with any real-world code yet though, will do.
Patch seems to work in the Real World as well (custom filter list model).
After discussing this with Kris, we came up with the following patch that should DTRT (TM). Can you guys try it instead?
Created attachment 26266 [details] [review] newer patch that sets the height
I'll commit this if you guys can confirm that it fixes your bugs.
Works for me, thanks!
Cool. I went ahead and committed this.