commit e473ee8b3fdff647cf76d9aaf50109ad7a2bca77
Author: Enrico Forestieri <[email protected]>
Date:   Mon Jul 6 20:38:35 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.
    
    This is a further amendment to 180ecbd7.

diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp
index 491b75d..ba84736 100644
--- a/src/mathed/MathMacro.cpp
+++ b/src/mathed/MathMacro.cpp
@@ -178,15 +178,10 @@ void MathMacro::assign(MathMacro const & that)
                        p->setOwner(this);
        }
        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(name(), pos) : 0;
-               if (!macro_)
-                       macro_ = &macroBackup_;
+               // 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_ = &macroBackup_;
        }
 }
 

Reply via email to