Re: GTKTreeView Question. (Core Dump on GList append) - Strange




   If I change the GList to a GSList, everythigng works as expected, i.e, no
coredump.
   Does GList has some initialization routines that I did not see on the docs
that is different froma GSList ? (likely improbable, but...).



--- Harring Figueiredo <harringf yahoo com> wrote:


 Thanks David,

 I tried to do like the API suggests. 
 I am getting a core dum on the fillowing code.

 gdb output:

Program received signal SIGSEGV, Segmentation fault.
0x403f03ba in g_list_last (list=0x7) at glist.c:628
628             list = list->next;
(gdb) where
#0  0x403f03ba in g_list_last (list=0x7) at glist.c:628
#1  0x403efc81 in g_list_append (list=0x8187668, data=0x7) at glist.c:250
#2  0x0804e42a in remove_input_dir_from_treeview (button=0x8187668,
empty=0x0)
    at settings_ui.c:34


  Here is the source code.
     30     for(tmpl = list; tmpl != NULL; tmpl = tmpl->next) {
     31         GtkTreeRowReference* ref =
     32             gtk_tree_row_reference_new (model, tmpl->data);
     33         if(ref)
     34             refs = g_list_append(refs,ref);
     35         g_warning("Ref!!!\n");
     36     }

  refs --> GList* (Initially null)
  
  list ->  GList returned from " list = gtk_tree_selection_get_selected_rows
(selection, &model);"


   I can not figure out the reason why this is happening.

   Any suggestion ?

Harring.

  
  


--- "David M. Cook" <dave davidcook org> wrote:
On Wed, Jul 16, 2003 at 03:36:55PM -0700, Harring Figueiredo wrote:

  (Sorry for the previous post with the wrong subject header.)


  Second question: How can I delete all the selected rows from a
treeview.
Calling the foreach func causes an error because when the row is deleted
it
renders the model invalid.

I ran into this problem just the other day.  My solution was to sort the
selected paths and then delete them from last to first. (It just occured to
me that my paths were probably already sorted.)

But the API docs suggest another solution:

gtk_tree_selection_get_selected_rows ()

GList*      gtk_tree_selection_get_selected_rows
                                            (GtkTreeSelection *selection,
          GtkTreeModel **model);
      
      Creates a list of path of all selected rows.    
      
========> Additionally, if you
are planning on modifying the model after calling this function, you may
want to convert the returned list into a list of GtkTreeRowReferences. To
do
this, you can use gtk_tree_row_reference_new_proxy(). <=======

Dave Cook

Dave Cook
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com



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