Re: Do TreeIters persist after foreach search ?



On Thu, 2007-11-08 at 11:53 +0000, Dave Howorth wrote:

I think there must be something I'm overlooking about iters. I have code
which for testing I've simplified to the following:

What works for me in Odot is storing a copy of the iterator:

    my $match_iter;
    $tree_store->foreach(
        sub {
            my ($tree_store, $path, $iter) = @_;

            my $level = $tree_store->get($iter, LEVEL);
            warn "  tree_store=$tree_store, iter=$iter;\n";

            $match_iter = $iter;

              $match_iter = $iter->copy;

            return TRUE;
        });

    warn "search $tree_store => $match_iter;\n";
    my $level = $tree_store->get($match_iter, LEVEL);

-- 
Bye,
-Torsten




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