On Wed, Oct 19, 2005 at 05:53:07PM +0200, Jean-Marc Lasgouttes wrote: > >>>>> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: > > Jean-Marc> Basically, dEPM compares the tips of cursors without caring > Jean-Marc> whether they are at same depth (insert apples and oranges > Jean-Marc> comment here). Here undo is called between two cursors at > Jean-Marc> different depth :( > > Jean-Marc> This is a real mess. > > I can confirm that last sentence. > > The following patch does a cleanup of dEPM in the following respects: > > 1/ call recordUndo with the right cursor, and only for the pit > contains `old' (this is the only paragraph we change) > > 2/ when comparing cursors, do not compare pit:s without first checking > that they are relative to the same inset > > 3/ when a paragraph has been removed,try to update the right slice of > `cur', which might not be the top. > > 4/ simplify the code to the point where I understand it.
Looks promising... though this is risky during a freeze. > The result of this patch is that I do not get a crash in dEPM any more > with the following (description courtesy of Bennett): > > > Type some arbitrary text. Below this, create an inset in a paragraph > > all by itself; set this paragraph to have no indentation. Place the > > cursor at the end of the line immediately above the inset. Press > > return to create a new paragraph, and then down-arrow: crash. > > However, I still get a crash in fitCursor() :( Did you try Juergen's remedy? > The relevant backtrace is: > > 0x0819ee76 in LCursor::getFont (this=0x883ee74) at cursor_slice.h:103 > 103 LyXText const * text() const { return inset_->getText(idx_); } Yes... look at cursor.C: 1201 LyXFont LCursor::getFont() const 1202 { 1203 // HACK. far from being perfect... 1204 int s = 0; 1205 // go up until first non-0 text is hit 1206 // (innermost text is 0 in mathed) 1207 for (s = depth() - 1; s >= 0; --s) 1208 if (operator[](s).text()) 1209 break; 1210 CursorSlice const & sl = operator[](s); 1211 LyXText const & text = *sl.text(); 1212 LyXFont font = text.getPar(sl.pit()).getFont( 1213 bv().buffer()->params(), 1214 sl.pos(), 1215 outerFont(sl.pit(), text.paragraphs())); 1216 1217 return font; 1218 } This is either line 1208 or line 1211. I suspect line 1211... what if sl.text() is a null pointer? Could happen if the break is never executed and the loop runs to its end. (Test for this to verify that this is indeed the problem!) Then we work back from there. - Martin > > I really cannot make sense of it. > > Martin, Help!!! > > Here is the patch FWIW. I still think it would be worth committing it. > > JMarc >
pgpiVDKgSHOQL.pgp
Description: PGP signature