X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fiterators.C;h=86c1218e8579e919d1c7e7a8ec693fc7dcf428e3;hb=27652900a60fd078f161ce866ddaed21dba21eff;hp=e94479dd049e60c8ed05430734ffe06bfaaa8e4c;hpb=0233b6753d5a7ef67263c3111411be04765c629b;p=lyx.git diff --git a/src/iterators.C b/src/iterators.C index e94479dd04..86c1218e85 100644 --- a/src/iterators.C +++ b/src/iterators.C @@ -2,7 +2,7 @@ #include "iterators.h" -ParIterator & ParIterator::operator++() +ParIterator & ParIterator::operator++() { while (!positions.empty()) { ParPosition & p = positions.back(); @@ -16,7 +16,11 @@ ParIterator & ParIterator::operator++() return *this; } ++p.it; - } + } else + // The following line is needed because the value of + // p.it may be invalid if inset was added/removed to + // the paragraph pointed by the iterator + p.it = p.par->inset_iterator_begin(); // Try to find the next inset that contains paragraphs for ( ; p.it != p.par->inset_iterator_end(); ++p.it) {