commit 4dff1394ab845878f16cb03455477cfb44ceb8cb Author: Enrico Forestieri <for...@lyx.org> Date: Sun Jul 5 20:44:54 2015 +0200
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. diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index 918a989..08f367c 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -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_; } }