On Sun, 2003-08-17 at 23:33, Vadim Berezniker wrote: > wilfried kopp wrote: > > Hi everybody, > > > > I am stuck with a segmentation fault caused by a treeview and I have pent hours trying to figure out what's wrong with no success. > > > > > > Here is how I create the model (I simplified the code... but this version crashes as well...) > > while (item) > > { > > gtk_list_store_append (store, &iter); > > gtk_list_store_set (store, &iter, > > MIME_TYPES_TO_SKIP_COLUMN_STATE, 0 , > > MIME_TYPES_TO_SKIP_COLUMN_MIME_TYPE, test, > > -1); > > > > item=g_list_next(item); > > } > > > > That looks OK. > > > The segmentation fault happens when I remove an item with this code: > > gtk_tree_model_get (model,&iter, > > 0, &state, > > 1, &mime_type, > > -1); > > > > Why are you using constants such as (MIME_TYPES_TO_SKIP_COLUMN_STATE and > MIME_TYPES_TO_SKIP_COLUMN_MIME_TYPE) in the code that adds data but > referencing them by number here. This could lead to problems if the > constants change later. > > > if (gtk_tree_selection_get_selected (listSelection, NULL, &iter)) > > { > > gtk_list_store_remove (GTK_LIST_STORE (model), &iter); > > } > > > > > > Here is what ddd says: > > (gtktalog:5396): Gtk-CRITICAL **: file ../../gtk/gtkliststore.c: line 566 (gtk_list_store_get_value): assertion `GTK_LIST_STORE (tree_model)->stamp == iter->stamp' failed > > > > The error seems to indicate that you modified the model after retrieving > the iterator, which invalidates the iterator. To avoid this, use a GtkTreeRowReference to recalculate a valid iterator. > > _______________________________________________ > > gtk-list@xxxxxxxxx > http://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list