[LyX/master] Set buffer when expanding macro

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sun Oct 20 10:42:50 UTC 2019


commit 19abf29ea0cf89cdc99b9327448146aeb35d1dc1
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Sun Oct 20 12:54:59 2019 +0200

    Set buffer when expanding macro
    
    This avoids a crash in InsetMathSplit which uses the buffer() value.
    
    Fixes bug #11686.
---
 src/mathed/InsetMathMacro.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index b5b0322..6e8ea5c 100644
--- a/src/mathed/InsetMathMacro.cpp
+++ b/src/mathed/InsetMathMacro.cpp
@@ -669,8 +669,9 @@ void InsetMathMacro::updateRepresentation(Cursor * cur, MacroContext const & mc,
 	// than the one protected by UpdateLocker.
 	docstring const & display = d->macro_->display();
 	docstring const latexname = from_ascii("\\") + macroName();
-	if (d->macro_->expand(values, d->expanded_)
-	    && !support::contains(display, latexname)) {
+	bool const ret = d->macro_->expand(values, d->expanded_);
+	d->expanded_.setBuffer(buffer());
+	if (ret && !support::contains(display, latexname)) {
 		if (utype == OutputUpdate && !d->expanded_.empty())
 			d->expanded_.updateMacros(cur, mc, utype, nesting);
 	}


More information about the lyx-cvs mailing list