Re: Bug in GTK CList gtk_clist_append?



Hi,

no guarantee on this answer....

>
>Anyone want to attempt telling me what this means?  =)
>
>#0  0x401c61ff in g_strdup (str=0x1 <Address 0x1 out of bounds>)
>    at gstrfuncs.c:56

It is trying to create a copy of the thing you are trying to put into the cell 
but fails somehow.

>#1  0x4008634f in set_cell_contents (clist=0x80abc28, clist_row=0x80c6bd8, 
>    column=1, type=GTK_CELL_TEXT, text=0x1 <Address 0x1 out of bounds>, 
>    spacing=0 '\000', pixmap=0x0, mask=0x0) at gtkclist.c:2475
>#2  0x40086a49 in real_insert_row (clist=0x80abc28, row=2,
>    text=0xbfffebc8) at gtkclist.c:2646
>#3  0x4008675e in gtk_clist_append (clist=0x80abc28, text=0xbfffebc8)
>    at gtkclist.c:2584
>#4  0x8054d08 in add_search_entry_activate (editable=0x80abf58, 
>    user_data=0x80abf58) at ./db/callbacks.c:281
>
>
>(callbacks.c:  linbe 281 is the line row = gtk...)
>
>  i = scandir (path[0], &filelist, add_select, alphasort);
>
>  if (i < 0)
>    printf ("scandir error\n");
>  else {
>    gtk_entry_set_text (GTK_ENTRY (user_data), path[0]);
>    for (j = 0; j < i; j++) {
>      row = gtk_clist_append (GTK_CLIST (add_file_list), path);
>      gtk_clist_set_text (GTK_CLIST (add_file_list), row, 1,
>                           filelist[j]->d_name);

Maybe this change is enough:
      gtk_clist_set_text (GTK_CLIST (add_file_list), row, 1,
                           g_strdup(filelist[j]->d_name) );

I suspect (really not sure!!!) that this might help. (It might be you get no
more coredumps but the labels are all the same or empty...dunno)
 
If not try to make char *filelist available for all the C code. I think the
point is to make a copy somewhere, as this is referred to in drawing/accessing
etc., and as the function declaration says must be some const gchar *text like
in gtkclist.h:

void gtk_clist_set_text (GtkCList    *clist,
			 gint         row,
			 gint         column,
			 const gchar *text);

To say it in other words: You have to pass a pointer in this *text field,
which does not only have filescope but must be readable from the function
containing the callback. Maybe g_strdup can do this also.

    hope that helps!

  Martin






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