Re: Treeview help needed

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,


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,

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.

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