On Wed, Nov 4, 2009 at 12:42 PM, dhk <dhk...@optonline.net> wrote:
> In the gtk-demo program has a block as follows in the Tree View/Tree
> Store example.  This doesn't initialize the the child iter before using
> it in the gtk_tree_store_append(), but the stamp is valid.

Iterators are not valid until they have been touched by a GtkTreeModel
method.  This will set the stamp of the iterator to correspond to the
current stamp of the model.  If an iterator that has just been
declared has the same stamp as the model, then that's just luck.  In
the block that you've pasted below, child_iter is invalid until
gtk_tree_store_append() returns.  gtk_tree_store_append() sets the
stamp on the iterator and thus makes it valid.


regards,

-kris.


> /* add children */
>      while (holiday->label)
>        {
>          GtkTreeIter child_iter;
>
>          gtk_tree_store_append (model, &child_iter, &iter);
>          gtk_tree_store_set (model, &child_iter,
>                              HOLIDAY_NAME_COLUMN, holiday->label,
>                              ALEX_COLUMN, holiday->alex,
>                              HAVOC_COLUMN, holiday->havoc,
>                              TIM_COLUMN, holiday->tim,
>                              OWEN_COLUMN, holiday->owen,
>                              DAVE_COLUMN, holiday->dave,
>                              VISIBLE_COLUMN, TRUE,
>                              WORLD_COLUMN, holiday->world_holiday,
>                              -1);
>
>          holiday++;
>        }
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to