Am Freitag, den 21.04.2006, 13:01 +0200 schrieb Colossus: > Enrico Tröger wrote: > > No, it is a simple decimal value. I appended the l to emphasise that it > > is a long int. I'm not completely sure, but I think you can safely omit > > it.
Why don't you use two lists instead of one? Same number of mallocs, just one pointer more to pass around. GList *nbr; GList *str; nbr = str = NULL; for (i = 0; mydatasource[i] != NULL; i++) { nbr = g_list_prepend (nbr, GUINT_TO_POINTER (mydatasource[i].myint)); str = g_list_prepend (str, g_strdup (mydatasource[i].mystr)); } nbr = g_list_reverse (nbr); str = g_list_reverse (str); fill_store (nbr, str); Another alternative for encapsulating two data types would be typedef struct { enum { LIST_DATA_STRING, LIST_DATA_NUMBER } data_type; union { char *mystr; guint64 mynum; } data; } MyListData; You'd do list_data = g_new (MyListData, 1); if (isstr) { list_data->data_type = LIST_DATA_STRING; list_data->data.mystr = g_strdup (mystr); } else { list_data->data_type = LIST_DATA_NUMBER; list_data->data.mynum = myint; } list = g_list_prepend (list, list_data); Note that this may cause some malloc overhead for many entries. It would be simpler if you described what you want to achieve with these two data types. There is definitly a better solution than stuffing everything into one single GList. > This is my code: > original = g_strndup ( start , end - start); > unsigned long long int *_original = g_malloc(sizeof(unsigned long long > int)); > *_original = atoll (original); > g_free (original); > > later I fill the GList: > archive->row = g_list_prepend (archive->row , _original) ; > > Then in another file.c I have to fill the liststore by retrieving the > values from the GList: > > gtk_list_store_set(GTK_LIST_STORE(list_store), &iter, i, fields->data, > -1); > > And in this line I get the segfault ! Obviously I declared that column > as G_TYPE_UINT64; > > It's related to the allocated u long long int pointer because if I use > GUINT_TO_POINTER with G_TYPE_UINT it works. Do you have any idea about > the crash ? Shouldn't you use GPOINTER_TO_UINT(fields->data)? I'm also curious why you use i, i.e. a running variable. How does your list store look? -- Christian Neumair <[EMAIL PROTECTED]> _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list