Alfredo Braunstein wrote:
Abdelrazak Younes wrote:
For instance, put a cursor inside an inset, then
in another window add or remove some text before the inset so the
position of the inset changes... no destruction occurs, but is the cursor
still valid? (sorry don't have svn to check here.)
No, and that is the purpose of the new method
DocIterator::FixIfBroken(). This will first validate the validity of the
CursorSlice (thus the existence of the insets) then the validity of the
text index, then the one of the cursor row, then the position in this row.

Ah! So you *are* sort of implementing the dociterator registering thing in a
sense: you just manually keep track of a few dociterators ;-).

Kindof yes :-)


Btw, just downloaded and had a look at the code, I think that the checks are
not done correctly, you should for instance get sure that the pos of the
inset is the one pointed in the parent slice, not just check that pos <=
lastpos. Otherwise you still get an invalid iterator methinks.

You are probably right.


Just a though... why do we need the invalidation signals at all? ...couldn't
we go in fixIfBroken from the top to the tip of the DocIterator checking
that there is an inset an the given position in the paragraph, and that the
pointer of that inset is the one in the iterator in the next slice (as well
as the idx, pit, pos checks)?

I did not think of that :-(. That could work indeed. I don't have the time to implement this right now, maybe this could be the occasion of a patch from you to signal that your come back is real? :-)

Abdel.

Reply via email to