Buffers for Math Insets
Richard Kimberly Heck
rikiheck at lyx.org
Sun Apr 26 07:33:14 UTC 2020
On 10/12/19 5:25 AM, Jean-Marc Lasgouttes wrote:
> Le 12/10/2019 à 04:38, Richard Kimberly Heck a écrit :
>> On 10/11/19 10:21 PM, Richard Kimberly Heck wrote:
>>> I'm working on bug #11104 (refstyle support in math) and have been
>>> running into a number of problems involving unset Buffer members for
>>> math insets. (I see a lot of warnings about this in stable, too.) The
>>> basic problem is that I need to access the BufferParams to find out
>>> whether we are using refstyle or not. But if the Buffer member isn't
>>> set....
>
> I have not seen so many of these.
>
>>> Might it make sense to call something like inset().setBuffer() whenever
>>> we go through updateBuffer? That is obviously overkill, but I don't
>>> know
>>> how else to ensure that the math insets are handled properly.
>>
>> PS We seem to reset the Buffers for whenever we move the mouse, so it
>> can't be that expensive. But if we do it whenever we updateBuffer, then
>> maybe we wouldn't need to do it whenever we move the mouse?
>
> What is the piece of code you are referring to? I agree that
> updateBuffer is a good place to do that and it would indeed not be
> expensive.
I think it is this simple:
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 0cc1d23f06..2ce28956c9 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -4925,6 +4925,7 @@ void Buffer::bufferRefs(TeXErrors const & terr,
ErrorList & errorList) const
void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const
{
LBUFERR(!text().paragraphs().empty());
+ d->inset->setBuffer(const_cast<Buffer &>(*this));
// Use the master text class also for child documents
Buffer const * const master = masterBuffer();
Thoughts? And we might then be able to remove the similar code at
Cursor::push.
Riki
More information about the lyx-devel
mailing list