commit cc360b4899f114c6e1e434c7fd6b7808f69460a5
Author: Richard Heck <rgh...@lyx.org>
Date:   Mon Jan 1 22:18:52 2018 -0500

    Fix bug #10951.
    
    The Buffer member for the remembered definition_ was not being set.
    
    (cherry picked from commit f130f7713fae326daa05795a5bf4761d33aee649)
---
 src/mathed/MathData.h    |    2 ++
 src/mathed/MathMacro.cpp |    6 ++++++
 src/mathed/MathMacro.h   |    2 ++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/mathed/MathData.h b/src/mathed/MathData.h
index 0419b59..ca2ddcf 100644
--- a/src/mathed/MathData.h
+++ b/src/mathed/MathData.h
@@ -171,6 +171,8 @@ public:
        void updateMacros(Cursor * cur, MacroContext const & mc, UpdateType);
        ///
        void updateBuffer(ParIterator const &, UpdateType);
+       ///
+       void setBuffer(Buffer & b) { buffer_ = &b; }
 
 protected:
        /// cached values for super/subscript placement
diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp
index 06d5a2c..268b998 100644
--- a/src/mathed/MathMacro.cpp
+++ b/src/mathed/MathMacro.cpp
@@ -1180,4 +1180,10 @@ void MathMacro::completionPosAndDim(Cursor const & cur, 
int & x, int & y,
 }
 
 
+void MathMacro::setBuffer(Buffer & buffer)
+{
+       d->definition_.setBuffer(buffer);
+       InsetMathNest::setBuffer(buffer);
+}
+
 } // namespace lyx
diff --git a/src/mathed/MathMacro.h b/src/mathed/MathMacro.h
index b389e27..9482646 100644
--- a/src/mathed/MathMacro.h
+++ b/src/mathed/MathMacro.h
@@ -129,6 +129,8 @@ public:
        size_t appetite() const;
        ///
        InsetCode lyxCode() const { return MATH_MACRO_CODE; }
+       /// Override so as to set Buffer for defnition_ member, too.
+       void setBuffer(Buffer &);
 
 protected:
        friend class MathData;

Reply via email to