Abdelrazak Younes wrote:

> Alfredo Braunstein wrote:
>> Abdelrazak Younes wrote:
>> 
>>> fixIfBroken). But I don't really understand why you think the signal
>>> solution is bad. This is the *only* way to ensure that the inset pointer
>>> inside CursorSlice is valid at any time. Even with Alfredo solution you
>>> could end up with an invalid pointer if you forgot to call
>>> fixIfBroken().
>> 
>> But you'll still end up with an invalid cursor if you forget to call
>> fixIfbroken,
> 
> Right but this case would be detected by an assertion whereas using an
> invalid inset pointer will crash LyX very badly.

What assertion? (I mean where in the code). IMO you can end up with an
invalid iterator that can blow up anywhere.

>> so there's no point in keeping the pointers valids, right?
> 
> I am not sure. The point is to make sure that we know if a CursorSlice
> is valid or not. Your idea about comparing the address of the current
> inset with the one listed in the insetlist of the enclosing paragraph in
> order to verify that the pointer address is valid might work. I am just
> saying that the signal approach is safer, that's all.

I think not, because the signals are *not* sufficient to determine if the
CursorSlice is still valid. 

Of course I think that all this is not very relevant because the right
solution would be to avoid the iterators being invalid in the first place.
As a side note, I wished really stable iterators from the very first lyx
pet project of mine, errorlists ;-) So it would be a nice thing to have in
general.

A/


Reply via email to