Re: GTree weirdness?




On 29 Nov 2001, Havoc Pennington wrote:


"James K. Wiggs" <wiggs wiggs org> writes:
Is the simple fact that I'm removing nodes
from the GTree while in the process of a g_tree_traverse() the
cause of my problems?

Yup.

   This strikes me as something that *really* ought to be in the
documentation.  Admittedly, I haven't done a lot of work with
tree structures, and perhaps this is something that's just a
given among those who use this technique a lot.  Still, to me it
is *not* intuitively obvious that this is a problem.

 And if so, how *do* I implement this
selective removal functionality?

As you traverse, make a list of items to remove. Then walk the list
and remove each item.

   Yeah, I already did this.  This was my third attempt to post my
question and the only successful one.  In the interim, I did just
the technique you suggested.  Works fine.

Havoc


best,
Jim Wiggs
wiggs wiggs org




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