Re: GtkListStore



martyn 2 russell bt com writes:

 I am confused by this statement :
"Additionally, some models guarantee that an iterator is 
valid for as long as
the node it refers to is valid (most notably the GtkTreeStore and
GtkListStore)" (GtkTreeModel doc).


  Does it mean that I can store/save the interator in my 
application and use it
later to access the data ? ( Even if I delete/add rows ? )

I wouldn't recommend it.  What happens if you store it and the thing it
points to gets deleted? or moved? I *THINK* that at that point the iterator
becomes invalid, but even if it doesnt and you use it, you will not be
pointing at what you expect to be pointing at.

You can keep the Iter around and access it for the life of the row with
a GtkListStore.  Once the row has been deleted, you had better get rid
of it.

I agree with you though, the documentation is not very clear when it
introduces phrases like "... some models ...".  To me this sounds like they
mean, "...depending on how the model is implemented..." - I could be wrong.

It depends on whether or not the model has the GTK_TREE_ITERS_PERSIST
flag set or not.

Thanks,
-Jonathan



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