>>>>> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes:

Georg> Jean-Marc Lasgouttes wrote:
>> Do you know when this can happen?

Georg> For example with the attached document.

>> I also thought it was not necessary.

Georg> If inInset is supposed to return always a valid pointer we
Georg> should assert in inInset and remove checks at other places. But
Georg> then I wonder what is wrong with the current code?

LyXText::read() is supposed to set it, I guess, but this never
happens. Actually, since LyXText does not know the underlying inset, I
am not sure how this could happen...

So, when a document is read from file, setInsetOwner is not invoked
correctly. It is done though for InsetTexts in read(), which calls
init(). This is IMO a bug, but I am not sure of a good fix. I tried:

- invoking insettext::init in Buffer::readDocument. I can't, because
  it is private (we could change that, though).

- invoking insettextread in Buffer::readDocument. The problem is that
  we are supposed to return a bool telling whether we found
  \end_inset/\end_document. 

What I did not try yet:

- pass the inset as parameter of LyXText::read, so that the
  setInsetOwner can be inoked on the paragraphs.

So, what would be the best solution?

JMarc

PS: it is amusing to see that the various Buffer::readFile methods use
a pit parameter, but it is never used...

PPS: it seems that insertion of a LyX file is busted.

Reply via email to