[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/2.3.x] Set buffer when expanding macro
From:       Jean-Marc Lasgouttes <lasgouttes () lyx ! org>
Date:       2019-10-22 16:06:37
Message-ID: 20191022160637.823902800C6 () lyx ! lyx ! org
[Download RAW message or body]

commit d3fd91566249b722dbc553b921283f2507ce5e17
Author: Jean-Marc Lasgouttes <lasgouttes@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.
    
    (cherry picked from commit 19abf29ea0cf89cdc99b9327448146aeb35d1dc1)
---
 src/mathed/InsetMathMacro.cpp |    5 +++--
 status.23x                    |    2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index 5e72eec..d354412 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);
 	}
diff --git a/status.23x b/status.23x
index e005d5e..bb1fd59 100644
--- a/status.23x
+++ b/status.23x
@@ -150,6 +150,8 @@ What's new
 
 - Fix bad caret position when row scrolls horizontally (bug 11603).
 
+- Fix crash when inserting some macros (bug 11686).
+
 
 * INTERNALS
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic