]> git.lyx.org Git - lyx.git/blobdiff - src/iterators.C
Yet another tweak from J�rgen.
[lyx.git] / src / iterators.C
index e94479dd049e60c8ed05430734ffe06bfaaa8e4c..86c1218e8579e919d1c7e7a8ec693fc7dcf428e3 100644 (file)
@@ -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) {