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 138082 - treeview crashes in fixed-height-mode.
treeview crashes in fixed-height-mode.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
2.4.x
Other Linux
: Normal major
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
: 138685 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-03-25 11:40 UTC by Markus Lausser
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
small program to trigger segfault (1.58 KB, text/plain)
2004-03-27 23:19 UTC, Tim-Philipp Müller
  Details
proposed patch. (1.62 KB, patch)
2004-04-02 13:45 UTC, Kristian Rietveld
none Details | Review
newer patch that sets the height (1.40 KB, patch)
2004-04-02 22:36 UTC, Jonathan Blandford
none Details | Review

Description Markus Lausser 2004-03-25 11:40:05 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.

Thread 1024 (LWP 11675)

  • #0 _gtk_rbtree_node_set_height
    at gtkrbtree.c line 724
  • #1 gtk_tree_view_row_inserted
    at gtktreeview.c line 6744
  • #2 _gtk_marshal_VOID__BOXED_BOXED
    at gtkmarshalers.c line 1028
  • #3 g_closure_invoke
    at gclosure.c line 437
  • #4 signal_emit_unlocked_R
    at gsignal.c line 2436
  • #5 g_signal_emit_valist
    at gsignal.c line 2195
  • #6 g_signal_emit
    at gsignal.c line 2239
  • #7 gtk_tree_model_row_inserted
    at gtktreemodel.c line 1374
  • #8 gtk_list_store_append
    at gtkliststore.c line 1347
  • #9 ui_filetree_node_show
    at ui_filetree.c line 172

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?
Comment 1 Tim-Philipp Müller 2004-03-27 23:17:45 UTC
I can reproduce this. Small test to trigger the segfault attached. 
 
Cheers 
-Tim 
 
 
 
Comment 2 Tim-Philipp Müller 2004-03-27 23:19:20 UTC
Created attachment 26009 [details]
small program to trigger segfault
Comment 3 Tim-Philipp Müller 2004-03-28 23:42:20 UTC
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 
 
Comment 4 Richard Hult 2004-03-31 10:33:40 UTC
The crash is reproducable for me too.
Comment 5 Johan (not receiving bugmail) Dahlin 2004-04-01 16:29:29 UTC
*** Bug 138685 has been marked as a duplicate of this bug. ***
Comment 6 Johan (not receiving bugmail) Dahlin 2004-04-01 16:30:19 UTC
attachment 26214 [details] in bug 138685 contains an even small testcase
Comment 7 Kristian Rietveld 2004-04-02 13:44:30 UTC
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.
Comment 8 Kristian Rietveld 2004-04-02 13:45:44 UTC
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.
Comment 9 Richard Hult 2004-04-02 14:25:04 UTC
The patch works for the simple testcase above. I haven't tried it with any
real-world code yet though, will do.
Comment 10 Tim-Philipp Müller 2004-04-02 14:54:20 UTC
Patch seems to work in the Real World as well (custom filter list model). 
 
Comment 11 Jonathan Blandford 2004-04-02 22:36:13 UTC
After discussing this with Kris, we came up with the following patch that should
DTRT (TM).  Can you guys try it instead?
Comment 12 Jonathan Blandford 2004-04-02 22:36:52 UTC
Created attachment 26266 [details] [review]
newer patch that sets the height
Comment 13 Jonathan Blandford 2004-04-02 22:37:49 UTC
I'll commit this if you guys can confirm that it fixes your bugs.
Comment 14 Richard Hult 2004-04-02 22:43:07 UTC
Works for me, thanks!
Comment 15 Jonathan Blandford 2004-04-02 23:09:16 UTC
Cool.  I went ahead and committed this.