Jean-Marc Lasgouttes schrieb:
Michael> Hi, the following (committed) patch fixes a deterministic
Michael> crash with inset-dissolve if you press erase at the end of
Michael> the inset.

Where was the crash?
You press erase at the end of an inset with CT enabled => crash.

What are the differences that seem fishy to you?
The control structure (see below) doesn't look symmetric, in particular when it comes to needsUpdate & return. I don't claim that something is wrong, I just feel uncertain.

I also find it confusing that we call cur.text()->setCursorIntern once and just setCursorIntern() at all other places.



bool LyXText::backspace(LCursor & cur)
{
   ...
   if (cur.pos() == 0) {
       ...
       Paragraph & prev_par = pars_[cur.pit() - 1];
if (!prev_par.isMergedOnEndOfParDeletion(cur.buffer().params().trackChanges)) {
           ...
           setCursorIntern(cur, cur.pit() - 1, prev_par.size());
           return true;
       }
       needsUpdate = backspacePos0(cur);
   } else {
       ...
       setCursorIntern(cur, cur.pit(), cur.pos() - 1,
               false, cur.boundary());
       ...
   }
   if (cur.pos() == cur.lastpos())
       setCurrentFont(cur);
   if (redoParagraph(cur.bv(), cur.pit()))
       cur.updateFlags(Update::Force);
   setCursor(cur, cur.pit(), cur.pos(), false, cur.boundary());
   ...
}


bool LyXText::erase(LCursor & cur)
{
   ...
   Paragraph & par = cur.paragraph();
   if (cur.pos() != cur.lastpos()) {
       ...
       needsUpdate = true;
   } else {
       ...
if (!par.isMergedOnEndOfParDeletion(cur.buffer().params().trackChanges)) {
           ...
           cur.forwardPos();
           needsUpdate = true;
       } else {
           setCursorIntern(cur, cur.pit() + 1, 0);
           needsUpdate = backspacePos0(cur);
       }
   }
   if (needsUpdate) {
       if (redoParagraph(cur.bv(), cur.pit()))
           cur.updateFlags(Update::Force);
       cur.text()->setCursorIntern(cur, cur.pit(), cur.pos());
} ...
}




Reply via email to