On 04/23/2011 06:56 AM, Edwin Leuven wrote:
Richard Heck<rgh...@comcast.net>  wrote:
Answer: No, probably not, because it's hard to see
how to do this without making copies, which would
just give us the same problem back again.
the attached avoids the crash for me by setting the macrocontext for
nested insets (and only doing the metrics call on the tail; we don't
need the one on head since we did a metrics call before on the whole
cell)

comments welcome (needed)

i thinks this needs to be fixed before 2.0

Definitely.

My main comment would be that I suspect, but of course couldn't verify, due to the crashes, that the same problem exists in the TexRow() output routine, since I found last night that the same code is there. I do not know if this sort of idea will be sufficient to fix that problem, too, though it might be. My worry is that there is something that happens during the updateBuffer() routine that will need doing.

Other comments....

+ InsetTableCell tail = InsetTableCell(*tabular.cellInset(cell).get());
+       tail.setBuffer(tabular.buffer());
+
+       // we need to set macrocontext position everywhere
+       // otherwise we crash with nested insets (e.g. footnotes)
+       // after decimal point
+       DocIterator mpos =
+         tabular.cellInset(cell)->getText(0)->macrocontextPosition();

const?

+       tail.getText(0)->setMacrocontextPosition(mpos);
+
+ ParagraphList::const_iterator pit = tail.getText(0)->paragraphs().begin(); + ParagraphList::const_iterator pend = tail.getText(0)->paragraphs().end();
+       for (; pit != pend; ++pit) {
+         InsetList::const_iterator iit = pit->insetList().begin();
+         InsetList::const_iterator end = pit->insetList().end();
+         for (; iit != end; ++iit) {
+           if (iit->inset->asInsetText()) {
+             Text * itext = iit->inset->asInsetText()->getText(0);
+             itext->setMacrocontextPosition(mpos);
+           }
+         }
+       }
+

Is that sufficient? What about a Note nested within the Footnote?

I wonder if we could try:
ParagraphList::const_iterator pit = tail.getText(0)->paragraphs().begin();
    buffer().updateBuffer(pit, OutputUpdate);
in place of the above. It looks dangerous, because the insets are not really part of the Buffer, but I think it will be OK in the context of LaTeX output. (I didn't try this earlier, because I wasn't sure how to get the ParIterator.) If this worked, then it would, I am pretty confident, also solve the problem in TexRow(), as well.

rh

Reply via email to