On Tue, Aug 12, 2003 at 02:35:12PM +0200, Lars Gullik Bjønnes wrote:
> Andre Poenitz <[EMAIL PROTECTED]> writes:
> 
> | Index: lyxtext.h
> | ===================================================================
> | RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v
> | retrieving revision 1.208
> | diff -u -p -r1.208 lyxtext.h
> | --- lyxtext.h       11 Aug 2003 09:08:53 -0000      1.208
> | +++ lyxtext.h       12 Aug 2003 12:22:15 -0000
> | @@ -512,6 +512,9 @@ public:
> |     /// return true if this is owned by an inset.
> |     bool isInInset() const;
> |  
> | +   /// recreate paragraphlist iterator from rowlist iterator
> | +   ParagraphList::iterator getPar(RowList::iterator rit) const;
> 
> Are you creating something? Or is this really just a find... so you
> are just returning a paragraphlist iterator.

Hm. Ok. Intention was "recreate lost information".

> 
> | @@ -2281,3 +2281,39 @@ int LyXText::getDepth() const
> |  {
> |     return cursor.par()->getDepth();
> |  }
> | +
> | +
> | +// re-creates par iterator from row iterator by counting zeros in
> | +// the sequence of pos values.
> | +
> | +ParagraphList::iterator LyXText::getPar(RowList::iterator row) const
> | +{
> 
> Drop this check. At most add an assert:
> (Assert(row != rows().end()))
> passing rows().end() should not be allowed.

For some funny reason I've seen all three messages in the output when
running LyX with a "more advanced patch" based on this code. But maybe
that's already an indication that the current core is not doing what it
is supposed to do.

> | +                   ++pit;
> | +                   if (pit == ownerParagraphs().end()) {
> | +                           lyxerr << "unexpected in
> | +   LyXText::getPar()" << endl;
> 
> is it only unexpected or completely bogus.

It means the row() stores an parlist iterator that's not belonging to
the current ownerParagraphs() (much like the cause of the multipar cut
crashs). 

I can't think of a scenario where it whould make sense to have a row
with an pit to a 'foreign' list, but I can't guarantee that the current
code thinks so as well.

Ok, as this is not part of the 'happy end scenario', an Assert might be
in order...

> ( Assert(pit != ownerParagraphs().end()) )
> 
> | +                           Assert(0);
> 
> false
> 
> | +                           return ownerParagraphs().begin();
> 
> drop this and leave the above Assert permanent.

Ok.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security, will not have,
nor do they deserve, either one.     (T. Jefferson or B. Franklin or both...)

Reply via email to