mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Avoid calling Buffer::getMacro inside the MathMacro copy constructor
It turns out that it is always better using the copy of the MacroData for updating the macro_ pointer to avoid problems related to the cursor position.
This commit is contained in:
parent
2ea3e07a23
commit
4dff1394ab
@ -194,15 +194,10 @@ void MathMacro::Private::updateChildren(MathMacro * owner)
|
||||
}
|
||||
|
||||
if (macro_ && lyxrc.preview == LyXRC::PREVIEW_ON) {
|
||||
// We need to update macro_ by ourselves because in this case
|
||||
// MathData::metrics() is not called when selecting a math inset
|
||||
DocIterator const & pos = macroBackup_.pos();
|
||||
Buffer const * buf = pos.buffer();
|
||||
if (buf && !theBufferList().isLoaded(buf))
|
||||
buf = 0;
|
||||
macro_ = buf ? buf->getMacro(owner->name(), pos) : 0;
|
||||
if (!macro_)
|
||||
macro_ = ¯oBackup_;
|
||||
// As MathData::metrics() is not called when instant preview is
|
||||
// on, we have to update macro_ by ourselves. In this case, we
|
||||
// simply let it point to the last known good copy of MacroData.
|
||||
macro_ = ¯oBackup_;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user