On 01/18/2010 12:18 PM, Jean-Marc Lasgouttes wrote:
"Vincent van Ravesteijn - TNW"<[email protected]>  writes:

It still crashes, but in a less evident way. I therefore
ran it under valgrind, which complains a lot (but does
not crash). It looks like the code refers to memory that
has been freed already.
I'm not doing difficult memory things.. So i'm a bit puzzled.
Everytime compl_vector::operator[] needs an index that does not exist,
it does a push_back which can/will reallocate the whole vector when a
bigger memory block is necessary. I had the same mysterious bugs with
tex2lyx a few months ago.

This means that if you hold a DocIterator&  of an element of the
compl_vector, it will eventually point into nowhere. I have found where
it happens yet, but it has to come from that.

And one solution is instead to use a list, which will not invalidate the iterators, even when new memory is allocated. I have had to do this in a couple places.

rh

Reply via email to