Re: TreeModel Problem



On Fri, 2005-03-25 at 12:18 -0600, Bob Caryl wrote:
> 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

A debugger, such as gdb, and/or valgrind will help here.

>  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
> 
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]