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

Peter Groves pdgroves at gmail.com
Tue Sep 14 22:49:14 CEST 2010


Thanks for offering to take a look. I'm sorry it's such a complicated
piece of code.  I've attached the module. Here's the quick explanation
of what's going on:

 - the data to be displayed is in a structure called a
 - makeTreeModel() populates a GTree.list_store with the data, plus a
boolean column to indicate if the row in the table is 'selected'
 - makeTreeView() creates a GTree.view of the list_store, with the
'selected' column viewed as an editable check box
 - setSelectedTacticsByMask() sets all the boolean values to true or
false based on a bitmask. this is where the segfault occurs when I try
to add calls to treeView#set_model to detach and reattach the treeModel.

In this version of the code, I actually try reattaching the model
before editing any data in the model, and it crashes there. That is, in
this code the "updating model info" log message is never reached. 

I noticed that when the view_columns are created, they take a
reference to the model columns. This would seem to cause an
inconsistency if I attached a new model. Am I suppose to be rebuilding
the view_columns each time I call set_model with a Some(x) value?

I'm now going to try to isolate the bug further if possible. Thanks for
any help.


p.s. The crash occurs both on Ubuntu Intrepid Ibex and Lucid Lynx
(10.04). Lablgtk versions listed in my apt repositories are 2.10.1-2 and
2.14.0 +dfsg-2build1, respectively.

On Tue, 14 Sep 2010 16:36:12 +0900
Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> wrote:

> Dear Peter,
> I tried to do the same kind of thing with the tree_model.ml example,
> and I don't see any segmentation fault when setting the model again.
> Can you show some code.
> Also the version numbers of lablgtk and gtk, and the platform used,
> would be useful.
> Jacques
> On Tue, Sep 14, 2010 at 10:56 AM, Peter Groves <pdgroves at gmail.com>
> wrote:
> > Hi,
> >
> > I'm trying to speed up a tree view using the hints in the tutorial
> > found here:
> >
> > http://plus.kaist.ac.kr/~shoh/ocaml/lablgtk2/treeview-tutorial/ch03s03.html#sec-treestore-adding-many-rows
> >
> > My problem is slightly different than the one described in the
> > tutorial, however. I'm not replacing rows in the table but just
> > changing the values in a single column. The column is booleans in
> > the model and "cell_renderer_toggle" in the view, which basically
> > means that one of the columns in the table contains a checkbox for
> > every row. The slow performance occurs when I try to set the values
> > of all the checkboxes in a batch. I have also tried disabling
> > sorting, but that did not seem to make any difference.
> >
> > So now I'm trying to detach the model from the view while I do the
> > batch update, then reattach them. I'm able to detach the model from
> > the view using:
> >
> >  - self.treeView#set_model None;
> >
> >  - Then I update the model by using an 'iter' over all the rows in
> > the model.
> >
> >  - Finally, I try to replace the model with:
> >    self.treeView#set_model (Some(self.treeModel#coerce));
> >
> > It segFaults on the last step. Are there any suggestions for what
> > might be going wrong or any way to debug this?
> >
> > Thanks,
> > Peter
> >
> > _______________________________________________
> > Lablgtk mailing list
> > Lablgtk at yquem.inria.fr
> > http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk
> >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TacticScoreTablePane.ml
Type: application/octet-stream
Size: 7927 bytes
Desc: not available
URL: <http://lists.ocamlcore.org/pipermail/lablgtk-list/attachments/20100914/4b9488df/attachment.obj>
-------------- next part --------------
Lablgtk mailing list
Lablgtk at yquem.inria.fr

More information about the Lablgtk-list mailing list