Joost Verburg wrote:

> Juergen Spitzmueller wrote:
>>  // cursor position might be invalid now
>> +    cur.pit() = cur.lastpit();
>>  cur.pos() = cur.lastpos();
>>  cur.clearSelection();
> 
> You are right! I compiled a debug version and this was exactly where it
> crashed when pressing delete. Your patch solves the problem.
> 
> At first I didn't notice because I triggered the crash by changing the
> text style. So there are some more places where the same error is made
> with lastpos.
> 
> With the attached patch it doesn't crash anymore. There is still one odd
> thing: When applying a text style to a number of selected cells in my
> example file, only the first list item actually gets the style (this bug
> also existed before the patch).

If you do

if (cur.pit() > cur.lastpit())
        cur.pit() = cur.lastpit();

then it is even suitable for 1.4.3 IMHO. I am not sure whether the test is
necessary, but cur.pit() > cur.lastpit() is clearly wrong.

I would not use fixIfBroken, I always understood that it is an additonal
safety measure. In this case we know that we might have invalidated the
cursor.


Georg

Reply via email to