TreeModel Problem
- From: Bob Caryl <bob fis-cal com>
- To: GTKMM LIST <gtkmm-list gnome org>
- Subject: TreeModel Problem
- Date: Fri, 25 Mar 2005 12:18:41 -0600
Hello Everyone,
I have had a strange experience working with a Gtk::TreeView. I am
representing a potential application menu with a Gtk::TreeStore for the
purpose of allowing the user to edit the menu selections available. One
of the TreeStore columns is editable and is a boolean data type. I
initially display an entire menu configuration, and then I read in a
file containing previously chosen options and I walk the TreeStore
setting the boolean column to true in each appropriate row of the
TreeStore. I am using Gtk::TreeModel::foreach_iter to walk the tree
searching for appropriate rows.
Here is the strange part: If I accomplish the entire task in the
constructor of my derived window, the application will crash with a
seg-fault whenever I open up any top level elements in the TreeView.
But, if I split the job up, i.e. I populate the TreeStore with all the
default data, call window.show() and then call another function that
walks the TreeStore setting the boolean columns in the appropriate rows
to TRUE afterwards, all is well.
I am perfectly happy to do this in this way, but I am curious as to why
it causes a seg-fault if the entire job is done in the window
constructor. I realize that this description is somewhat abstract, but
after viewing the application stack backtrace in gdb I feel that my
application in trying to set these boolean columns was trying to
reference pointers that may not have been initialized. The seg-fault
always backtraced into the glibc malloc routine, btw. Links to the
source follow:
main.cpp <www.nehp.net/%7Ercaryl/main.cpp>
mnucfg.cpp <www.nehp.net/%7Ercaryl/mnucfg.cpp>
mnucfg.h <www.nehp.net/%7Ercaryl/mnucfg.h>
Thanks,
Bob Caryl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]