Re: Do TreeIters persist after foreach search ?



muppet wrote:
The iters are intended to be used on the stack in C, so for a foreach(), they
would be destroyed before returning from the foreach() call.

I saw the sentence about allocation on the stack but then it's followed
by the specific 'guarantee that an iterator is valid for as long as the
node it refers to is valid'. We learn by experience!

Instead, either store the $path or, better yet, the data from the row that you
found, like this:

<snip code>

Alternatively, you could just call the i-found-it-action in the foreach
callback when you find the row you want, and avoid the issue.

I'm trying this. I've basically inverted my algorithm so I can step
through the gtk tree once and search a hash containing the matching data.

(I should've read the whole thread before replying...)

Thanks to you and Emmanuele for taking the time to help.

Cheers, Dave



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