Hello everyone
I am working on an app which uses GtkTreeView and GtkListStore and I can't insert any data into the store and getting following error.
gtk_list_store_append: assertion `iter != NULL' failed
To give some light:
i have a structure MainView with GtkWidget *list_view defined
in main function I call create_main_window function with argument (MainView **) where I init whole UI. This function calls create_view function (again massing MainView ** argument). Create_view funtion creates view into list_view variable and everything is so far ok. Create view calls create_model (MainView **ui_data, GSList *input) where input contains correct data from db (checked with debugger).
And here is the problem:
create_model can access view needed (passed in MainView structure) and contains this
// Append fetched data to a store
input_iter = g_slist_nth (input, 0);
store = gtk_list_store_new (CAR_NUM_COLS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_LONG, G_TYPE_LONG, G_TYPE_LONG);
while (input_iter != NULL) {
gtk_list_store_append (store, iter);
gtk_list_store_set (store, iter, CAR_COL_MAKER, ((Car *) (input_iter->data))->maker, CAR_COL_MODEL, ((Car *) (input_iter->data))->model, CAR_COL_PLATE, ((Car *) (input_iter->data))->plate, CAR_COL_MILEAGE, ((Car *) (input_iter->data))->mileAtStart, CAR_COL_OIL, ((Car *) (input_iter->data))->oilChange, CAR_COL_SERVICE, ((Car *) (input_iter->data))->periodicService, -1);
Then I free data in GSList and has
gtk_tree_view_set_model (GTK_TREE_VIEW ((*main_view)->cars_list_view), GTK_TREE_MODEL (store));
g_object_unref (store);
But the problem is that on line gtk_list_store_append (store, iter)
I have: gtk_list_store_append: assertion `iter != NULL' failed
GLIB CRITICAL ** Gtk - gtk_list_store_set_valist: assertion `VALID_ITER (iter, list_store)' failed
can anyone help me with this and if possible explain me what I am doing wrong?
ps: I have NO data in the view after all but the app is running
I am working on an app which uses GtkTreeView and GtkListStore and I can't insert any data into the store and getting following error.
gtk_list_store_append: assertion `iter != NULL' failed
To give some light:
i have a structure MainView with GtkWidget *list_view defined
in main function I call create_main_window function with argument (MainView **) where I init whole UI. This function calls create_view function (again massing MainView ** argument). Create_view funtion creates view into list_view variable and everything is so far ok. Create view calls create_model (MainView **ui_data, GSList *input) where input contains correct data from db (checked with debugger).
And here is the problem:
create_model can access view needed (passed in MainView structure) and contains this
GSList *input_iter;
GtkTreeIter *iter = NULL;
GtkListStore *store;
// Append fetched data to a store
input_iter = g_slist_nth (input, 0);
store = gtk_list_store_new (CAR_NUM_COLS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_LONG, G_TYPE_LONG, G_TYPE_LONG);
while (input_iter != NULL) {
gtk_list_store_append (store, iter);
gtk_list_store_set (store, iter, CAR_COL_MAKER, ((Car *) (input_iter->data))->maker, CAR_COL_MODEL, ((Car *) (input_iter->data))->model, CAR_COL_PLATE, ((Car *) (input_iter->data))->plate, CAR_COL_MILEAGE, ((Car *) (input_iter->data))->mileAtStart, CAR_COL_OIL, ((Car *) (input_iter->data))->oilChange, CAR_COL_SERVICE, ((Car *) (input_iter->data))->periodicService, -1);
Then I free data in GSList and has
gtk_tree_view_set_model (GTK_TREE_VIEW ((*main_view)->cars_list_view), GTK_TREE_MODEL (store));
g_object_unref (store);
But the problem is that on line gtk_list_store_append (store, iter)
I have: gtk_list_store_append: assertion `iter != NULL' failed
GLIB CRITICAL ** Gtk - gtk_list_store_set_valist: assertion `VALID_ITER (iter, list_store)' failed
can anyone help me with this and if possible explain me what I am doing wrong?
ps: I have NO data in the view after all but the app is running
Thank in advance
Johnnnie
Last edited by johnnnie; 2009-12-12 at 20:31.