Alfredo Braunstein wrote:
Abdelrazak Younes wrote:
Abdelrazak Younes wrote:
Alfredo Braunstein wrote:
Abdelrazak Younes wrote:
Either Alfredo or JMarc I guess...
Pretty sure it's not mine... :-)
It's JMArc then :-)
Here is a fix. What is the purpose of this DocIterator::forwardIdx()?
If we are within a cell, pit_ and pos_ are not important.
Hum, apparently they are. Another assertion happens in the next
iteration in updateLabels(Buffer const & buf, ParIterator & parit):
Yes, they have meaning in tabulars (the only multi-text insets we have),
inset -> tabular
idx -> tabular cell
pit -> paragraph inside this cell
pos -> position inside the paragraph
OK but I don't think this is a valid use of pit and pos in this case.
One should use:
idx -> tabular cell
getText(idx).pit -> paragraph inside this cell
getText(idx).pos -> position inside the paragraph
using pit and pos as shortcuts is wrong IMHO.
BOOST_ASSERT(parit.pit() == 0);
It seems that there's no convenient way to iterate over all cells of a
tabular with a DocIterator :-/ The assert in forwardIdx is correct
considering that the past-the-end idx doesn't lead to a valid cursor
position.
This situation will happen anytime we use fordwardIdx() in a loop so I
modified nevertheless the assertion to fix the crash:
Author: younes
Date: Tue Aug 14 16:31:41 2007
New Revision: 19560
URL: http://www.lyx.org/trac/changeset/19560
Log:
Fix crash with updateLabels(). I changed the the test in the assertion
but endless loops should be equally prevented with this version.
Modified:
lyx-devel/trunk/src/DocIterator.cpp
Modified: lyx-devel/trunk/src/DocIterator.cpp
URL:
http://www.lyx.org/trac/file/lyx-devel/trunk/src/DocIterator.cpp?rev=19560
==============================================================================
--- lyx-devel/trunk/src/DocIterator.cpp (original)
+++ lyx-devel/trunk/src/DocIterator.cpp Tue Aug 14 16:31:41 2007
@@ -375,8 +375,7 @@
CursorSlice & tip = top();
//prevent endless loops
- BOOST_ASSERT(tip.idx() < lastidx());
-
+ BOOST_ASSERT(tip.idx() < tip.nargs());
++tip.idx();
tip.pit() = 0;
tip.pos() = 0;