Buffers for Math Insets

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sat Oct 12 18:17:12 UTC 2019


Le 12/10/2019 à 17:25, Richard Kimberly Heck a écrit :
> It's called from Cursor::push:
> 
> void Cursor::push(Inset & p)
> {
>      push_back(CursorSlice(p));
>      p.setBuffer(*buffer());
> }
> 
> So it's actually called whenever we descend into an inset as well.

It would be nice to have a strategy for being sure that the buffer is 
set as soon as possible in every case, so that we do not have to resort 
to hacks like this (i.e. set the cursor at many different places so that 
we avoid crashes). We should audit the cases where insets are created 
without a buffer.

A solution would be to force the presence of a Buffer parameter in Inset 
constructors. Then we would see the places where an explicit 0 cannot be 
avoided, and see what we can do about it. The only place where 0 makes 
sense is in the clipboard as I see it. Even then, the clipboard could be 
a buffer in itself if really needed.

This is a long-term solution, of course.

JMarc


More information about the lyx-devel mailing list