Re: gtk_list_store_append segfaults
- From: Jesper Mørk <geo fusserne dk>
- To: "Nils O." Selåsdal <noselasd frisurf no>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: gtk_list_store_append segfaults
- Date: Fri, 27 Feb 2004 15:44:16 +0100
On Fri, 2004-02-27 at 15:33, Nils O. Selåsdal wrote:
<snip>
Are you 100% sure the data is valid ?
That is movie is not NULL.
movie->mid,movie->borrowed is valied and so on.
To check, please g_print everyone of them right before you instert them
into
the liststore.
Very sure. Besides its gtk_list_store_append and not the set function that fails.
Relevant code:
model = gtk_list_store_new(6, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
tree_view = gtk_tree_view_new();
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), tree_view);
gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view),
GTK_TREE_MODEL(model));
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, movie->mid, 1,
movie->title, 2, movie->imdb, 3, movie->mediasource, 4,
movie->mediaformat, 5, movie->borrowed, -1);
It is also very relevant how you do your loop if you insert more
than the one row in the example above.
How so? Here my intire loop:
printf("Get first element...\n");
movie_element = g_list_first(movies);
while(movie_element != NULL){
printf("Dereferencing...\n");
/* De reference list data */
movie = (Movie*)movie_element->data;
printf("Setting elements...\n");
/* Set values on list... */
printf("Appending...%p\n", iter);
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
printf("Setting...\n");
gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, movie->mid, 1,
movie->title, 2, movie->imdb, 3, movie->mediasource, 4,
movie->mediaformat, 5, movie->borrowed, -1);
/* Go to next element in list */
printf("Get next element...\n");
movie_element = g_list_next(movie_element);
}
/Jesper
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]