Re: [patch] several possible crashes due to invalid paragraph metrics

2007-06-04 Thread Stefan Schimanski
It might be incorrect. But it cannot cause a crash. A paragraph always starts at 0 and ends at par.size()-1. So as long as we stay in this interval the computeTables is safe, even if the metrics are not the right one. Can you try to make a patch implementing a setCurrentFont flag in the cur

Re: [patch] several possible crashes due to invalid paragraph metrics

2007-06-03 Thread Jürgen Spitzmüller
Stefan Schimanski wrote: > +   // possibly the row metrics are outdated and the endpos() was > computed +   // before the paragraph was changed (e.g. by backspace) > +   end_ = std::min(par.size(), row.endpos()) - 1; > +    This solution looks OK to me for now. Jürgen

Re: [patch] several possible crashes due to invalid paragraph metrics

2007-06-03 Thread Dov Feldstern
Stefan Schimanski wrote: If that's too risky / too hard until after the 1.5.0 release, then I prefer your previous solution, of forcing a recalculation of the metrics before calling computeTables --- as you pointed out to me, even though we'll be computing the metrics twice that way, it's prob

Re: [patch] several possible crashes due to invalid paragraph metrics

2007-06-03 Thread Andre Poenitz
On Sat, Jun 02, 2007 at 06:17:46PM +0200, Stefan Schimanski wrote: > Another possibility of course (which I proposed somewhere in the > other thread about the backspace case of Dov) is so redo the metrics > of the current paragraph before setting the current font again. But > then I guess the

Re: [patch] several possible crashes due to invalid paragraph metrics

2007-06-03 Thread Stefan Schimanski
If that's too risky / too hard until after the 1.5.0 release, then I prefer your previous solution, of forcing a recalculation of the metrics before calling computeTables --- as you pointed out to me, even though we'll be computing the metrics twice that way, it's probably negligible next t

Re: [patch] several possible crashes due to invalid paragraph metrics

2007-06-02 Thread Dov Feldstern
Stefan Schimanski wrote: Another possibility of course (which I proposed somewhere in the other thread about the backspace case of Dov) is so redo the metrics of the current paragraph before setting the current font again. But then I guess they are computed twice, also during the paragraph upda

Re: [patch] several possible crashes due to invalid paragraph metrics

2007-06-02 Thread Stefan Schimanski
Another possibility of course (which I proposed somewhere in the other thread about the backspace case of Dov) is so redo the metrics of the current paragraph before setting the current font again. But then I guess they are computed twice, also during the paragraph update later. Stefan A

[patch] several possible crashes due to invalid paragraph metrics

2007-06-02 Thread Stefan Schimanski
Hi! In http://bugzilla.lyx.org/show_bug.cgi?id=3790 a bug is reported that LyX crashes when deleting a display math at the end of a paragraph. In fact the same bug can also be triggered by backspace, enter to rebreak the paragraph and probably many more ways. The reason is that Text::setC