Fix bug #8884: Crash when "navigate to next change"

The two fixes here a obviously right, although it is not clear why they are sufficient to fix the bug. Anyway I cannot reproduce any crash with it.

 * the first part just conditions a whole if/else to change_next_pos.changed(). Originally, only the if branch was concerned.

 * the second part is to avoid calling CursorSlice::backwardPos() when position is 0. Doing this leads to an assertion.
This commit is contained in:
Jean-Marc Lasgouttes 2013-09-27 10:47:36 +02:00
parent 5c0cf4cc51
commit 191d44a557
2 changed files with 16 additions and 10 deletions

View File

@ -421,12 +421,13 @@ bool findChange(BufferView * bv, bool next)
// of this function). This will avoid changes to be selected half.
bool search_both_sides = false;
Cursor tmpcur = cur;
// Leave math first
// Find enclosing text cursor
while (tmpcur.inMathed())
tmpcur.pop_back();
Change change_next_pos
= tmpcur.paragraph().lookupChange(tmpcur.pos());
if (change_next_pos.changed() && cur.inMathed()) {
if (change_next_pos.changed()) {
if (cur.inMathed()) {
cur = tmpcur;
search_both_sides = true;
} else if (tmpcur.pos() > 0 && tmpcur.inTexted()) {
@ -435,7 +436,9 @@ bool findChange(BufferView * bv, bool next)
if (change_next_pos.isSimilarTo(change_prev_pos))
search_both_sides = true;
}
}
// find the next change
if (!findChange(cur, next))
return false;
@ -443,7 +446,7 @@ bool findChange(BufferView * bv, bool next)
CursorSlice & tip = cur.top();
if (!next)
if (!next && tip.pos() > 0)
// take a step into the change
tip.backwardPos();

View File

@ -77,7 +77,10 @@ What's new
- Fix hang when using BibTeX files with really long author lists (bug 8944).
- Fix crash with changetracking in bibliography environment (bug 8646).
- Fix crash with changetracking in bibliography environment (bug
8646).
- Fix crash when navigating to next change (bug 8884).
- Fix crash when optional argument inside a math macro was deleted (bug 8329).