On Sun, Aug 09, 2009 at 08:59:47PM +0200, Abdelrazak Younes wrote: > On 09/08/2009 20:50, Vincent van Ravesteijn wrote: >> Abdelrazak Younes schreef: >>> On 09/08/2009 20:48, Vincent van Ravesteijn wrote: >>>> Abdelrazak Younes schreef: >>>>> Hi, >>>>> >>>>> There used to be a recursive call to setBuffer() at the top of >>>>> Buffer::updateLabels(); is there a reason why this has been >>>>> removed? Now we get crashes with a lot of LFUNs because of the >>>>> buffer absence. Try LFUN_PARAGRAPH_MOVE_UP for example... >>>>> >>>>> Abdel. >>>>> >>>> The reason is that we decided that it shouldn't be there. >>> >>> And the reason why you decided this? >>> >>> :-) >>> >>> Abdel. >>> >> The reason was that we couldn't think of a valid reason that it should >> be there. >> >> :-) > > OK, then now you have one: safety. There are a lot of cases where insets > are copied, LFUN_PARAGRAPH_MOVE_UP being one: > > swap(pars_[pit], pars_[pit - 1]); > > AYCS, there are two Paragraph copy operations here. OK, in this case I > agree we should not do a copy here but really swap the paragraphs at > 'pit' and 'pit-1'. > > So we have two solutions: > 1) set the Buffer again for pars_[pit] and pars_[pit - 1] and do this > for all operation that involves a Paragraph or an Inset copy. > 2) set the buffer for all paragraphs and insets in updateLabel() as this > is guaranted to be be called each time each time a new Paragraph or a > new inset is created or removed.
3) store inset parents, instead of buffer pointers, buffer() is the buffer stored in the outermost InsetText. Swapping paragraphs within the same InsetText/Text would not even have to adjust anything. Andre'