Abdelrazak Younes wrote:
Your assertion seems to indicate that the Changes table contains a bad
entry. Could you add some debug output and verify what the values are?
Well, we were right about the problem. This is a new file, typing "123",
then return.
Changes.cpp(219): Inserting change of type 1 at position 0
Changes.cpp(130): setting change (type: 1, author: 0, time: 1223060073)
in range (0, 1)
Changes.cpp(165): inserting change
Changes.cpp(280): found change of type 1 and range (0, 1)
Changes.cpp(265): found intersection of range (0, 2) with (0, 1) of type 1
->that was the first character. note the 2 here. this may looks
suspicious, but it seems that the change stuff allows this. Note the
assertions in Paragraph::isChanged():
LASSERT(start >= 0 && start <= size(), /**/);
LASSERT(end > start && end <= size() + 1, /**/);
So end can apparently go past size(). This is the problem we're seeing
later.
Changes.cpp(219): Inserting change of type 1 at position 1
Changes.cpp(130): setting change (type: 1, author: 0, time: 1223060073)
in range (1, 2)
Changes.cpp(165): inserting change
Changes.cpp(280): found change of type 1 and range (0, 1)
Changes.cpp(299): merging ranges (0, 1) and (1, 2)
Changes.cpp(280): found change of type 1 and range (0, 2)
Changes.cpp(265): found intersection of range (0, 3) with (0, 2) of type 1
->that was the second character.
Changes.cpp(219): Inserting change of type 1 at position 2
Changes.cpp(130): setting change (type: 1, author: 0, time: 1223060074)
in range (2, 3)
Changes.cpp(165): inserting change
Changes.cpp(280): found change of type 1 and range (0, 2)
Changes.cpp(299): merging ranges (0, 2) and (2, 3)
Changes.cpp(280): found change of type 1 and range (0, 3)
Changes.cpp(265): found intersection of range (0, 4) with (0, 3) of type 1
->the third, now about to <enter>
Changes.cpp(130): setting change (type: 1, author: 0, time: 1223060075)
in range (3, 4)
--> That line is where the mistake is, I think.
Changes.cpp(165): inserting change
Changes.cpp(280): found change of type 1 and range (0, 3)
Changes.cpp(299): merging ranges (0, 3) and (3, 4)
Changes.cpp(280): found change of type 1 and range (0, 4)
Changes.cpp(416): Paragraph pit=0 size=3 Change from 0 to 4
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:707:
typename _Alloc::rebind<_CharT>::other::reference
std::basic_string<Char, Traits, Alloc>::operator[](typename
_Alloc::rebind<_CharT>::other::size_type) [with _CharT = wchar_t,
_Traits = std::char_traits<wchar_t>, _Alloc = std::allocator<wchar_t>]:
Assertion '__pos < size()' failed.
There are remarks in RowPainter::paintChangeBar() about the "imaginary
end of par character", which seems to have something to do with this
aspect of change-tracking and is probably why the range extends past the
end of the paragraph. So maybe what we need to do is just check if we're
at the end of the paragraph before we make the call:
str += " " + dit.paragraph().asString(it->range.start,
it->range.end);
and subtract one if so.
No more time....
Richard