[Lablgtk] segfault when reattaching a tree model to a tree view

Peter Groves pdgroves at gmail.com
Wed Sep 15 10:02:54 CEST 2010


You're example ran fine (once i ran it properly :). I noticed (through
brute force guess and check) that in my code I was able to work around
the bug by changing the vpolicy on the scroll bar to `ALWAYS instead

After much trial and error to bring your example in line with my code,
I have been able to reproduce the bug with as few changes as possible
to your example. The code is attached. The program should crash when
you click the 'dump' button. In the current form, you can make the bug
 go away by either
1) changing the vpolicy of the scroll_window to 'ALWAYS on line 142,
2) you can remove the call to scrollContainer#set_resize_mode
`IMMEDIATE; on line 140.

Both result in correctly working code for me.

While I'm sure you're capable or running a diff on the files, here are
the changes I made:

- I added a call to  GtkMain.Main.init () on line 17. You will
probably want to delete this. (My build system is weird - this was the
easiest way for me to get it to link properly.)

- When the 'dump' button is pressed, it definitely calls
set_model#(Some model) instead of only on an exception. this is where
the segfault occurs.

- the scrolled_window is packed in a GBin.alignment container before
being packed in the top level vbox layout. Honestly, I don't remember
why this is in my code, I was applying it to all widgets to ensure
some consistent behaviour, but I'm not sure what.

So there you go - the bug occurs when the model is set on a tree_view
in a scrolled_window with vpolicy of `AUTOMATIC and the scroll bar is
in a GBin.alignment with it's resize_mode set to `IMMEDIATE.

For me, the workaround of setting the vpolicy to `ALWAYS is
acceptable. Sadly, this whole exercise has not led to a speed increase
in the slowness I was originally trying to solve, but hopefully the
bug report does some good.


On Wed, Sep 15, 2010 at 2:11 AM, Jacques Garrigue
<garrigue at math.nagoya-u.ac.jp> wrote:
> On Wed, Sep 15, 2010 at 1:41 PM, Peter Groves <pdgroves at gmail.com> wrote:
>> One more update: when I put the tree_view in a scrolled_window the
>> "wrong" way, where the column headers scroll away like everything
>> else, the problem also goes away. I do this by adding the tree_view to
>> the scrolled_window using scroller#add_with_viewport instead of
>> scroller#add.
> I was using #add_with_viewport.
> Here is a new version of tree_model.ml which does it right.
> Again, you must link it with gtkInit.cmo.
> For me it works correctly.
> Jacques
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tree_model4.ml
Type: text/x-ocaml
Size: 6941 bytes
Desc: not available
URL: <http://lists.ocamlcore.org/pipermail/lablgtk-list/attachments/20100915/da6b892f/attachment.bin>
-------------- next part --------------
Lablgtk mailing list
Lablgtk at yquem.inria.fr

More information about the Lablgtk-list mailing list