On Mon, 4 Feb 2002, Dekel Tsur wrote: > On Mon, Feb 04, 2002 at 02:36:47PM +1000, Allan Rae wrote: > > > I won't have time to look at this before next week. It is however > > related to the iterator usage in that function (as reported in > > Michael's Purify report). We have a vector iterator, erase what that > > iterator pointed at and then expect it to point to the next item in > > the vector after the erase. I don't think this is always valid so it > > True. > > > should probably just need something like: > > iterator temp = iter->next(); > > iter->erase(); > > iter = temp; > > Maybe. Maybe I need to reread how vector iterators are supposed to > > work? > > This is not valid either.
D'oh! > A valid code is: > > int i = iter - vec.begin(); > iter->erase(); > iter = vec.begin() + i; Seems like the best solution offered so far. Would you mind adapting this to fix the problem in BufferView2.C:191-199 since you thought of it? ;-) There are almost certainly other places that make the same mistake. I also noticed last week that there are heaps of places in both paragraph.C and paragraph_pimpl.C that should or could use Paragraph::InsetIterator(pos_type pos) instead of duplicating that code. Might save a few bytes in binary size. Something for further cleanup anyway. Allan. (ARRae) Still trying to get the linux.conf.au seminar prepared