Note that there are some explanatory texts on larger screens.

plurals
  1. PORe-using an existing GtkTreeView
    primarykey
    data
    text
    <p><strong>TL;DR:</strong> <code>assertion 'VALID_ITER (parent, tree_store)' failed</code>. How do I fix it?</p> <p>I've successfully displayed a GtkTreeView in my application with the following (trimmed) code:</p> <pre><code>enum { DISPLAY_COLUMN, N_COLUMNS }; GValue comment = G_VALUE_INIT; GValue amount = G_VALUE_INIT; GtkTreeIter toplevel, child; GtkTreeStore *treestore = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING); for(int step = 0; step &lt; recipe_count; step++) { g_value_init(&amp;comment, G_TYPE_STRING); g_value_set_string(&amp;comment, recipe[step].comment); gtk_tree_store_append(treestore, &amp;toplevel, NULL); gtk_tree_store_set_value(treestore, &amp;toplevel, COMMENT_COLUMN, &amp;comment ); g_value_init(&amp;amount, G_TYPE_STRING); g_value_set_string(&amp;amount, recipe[step].amount); gtk_tree_store_append(treestore, &amp;toplevel, &amp;child); gtk_tree_store_set_value(treestore, &amp;toplevel, COMMENT_COLUMN, &amp;amount ); g_value_unset(&amp;amount); g_value_unset(&amp;comment); } gtk_tree_view_set_model(GTK_TREE_VIEW(app-&gt;step_tree),GTK_TREE_MODEL(treestore)); GtkCellRenderer *renderer = gtk_cell_renderer_text_new(); GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes ("Step", renderer, "text", DISPLAY_COLUMN, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(app-&gt;step_tree), column); </code></pre> <p>All of the above is wrapped up in a function, so that I can load new data again later. However, the second time I try to </p> <pre><code>(recipe_editor:11451): Gtk-CRITICAL **: IA__gtk_tree_store_append: assertion `VALID_ITER (parent, tree_store)' failed (recipe_editor:11451): Gtk-CRITICAL **: IA__gtk_tree_store_set_value: assertion `VALID_ITER (iter, tree_store)' failed </code></pre> <p>I know this means there's something wrong with my iterator(s), but I'm not sure how to actually fix it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload