Re: $model->iter_next fix



On Tue, 2003-11-18 at 17:01, Ross McFarland wrote:

$nextiter = $model->iter_next ($iter)

If only iter_next didn't need $model, we could use $iter->next, which
would be really Perl'ish and consistent with what you can do to
GtkTreePath'.  Oh well.

[...], in c, you would simply copy the iter and the iter_next the copy,
but you don't get copy in perl for various/obvious reasons.

Okay, it's obvious because the Perl programmer shouldn't need to worry
about memory management.  But $iter->copy has other uses, too.  As an
example you can use it to store iterators while in a $model->foreach
loop.  If you just store $iter, it'll be invalid as soon as you leave
the loop.  If you store $iter->copy, though, it'll still be valid.

Without $iter->copy, you need to resort to TreeRowReferences, which get
the job done but are more cumbersome and not available on all versions
of GTK+.

In case that convinced you, I've attached a patch that enables
$iter->copy.

Attachment: gtk_tree_iter_copy.patch
Description: Text Data



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