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.
To be slightly more helpful.
There was a large FIXME next to this call that this should be done in
the pasteSelectionHelper, so we moved it there:
// FIXME Should we do it here, or should we let updateLabels() do it?
// Set paragraph buffers. It's important to do this right away
// before something calls Inset::buffer() and causes a crash.
for (pit_type p = startpit; p <= pit; ++p)
pars[p].setBuffer(const_cast<Buffer &>(buffer));
We came to this because of some bug which apparently wanted to have
access to the buffer before updateLabels was called, I don't know the
details anymore.
Afterwards we fixed some of those missing buffer problems, like in
outlineUp and friends.
Basically we think it's a bit lazy to start moving around paragraphs
without ensuring that a decent buffer is set. Moreover, I think that we
should do it only at one place. That place would be somewhere in
CutAndPaste. There is no other reason than pasting that the buffer
should get invalidated.
I'm not sure why swap(pars_[pit], pars_(pit-1)) would invalidate the
buffer ?
Vincent