]> git.lyx.org Git - lyx.git/commitdiff
Set buffer when expanding macro
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 20 Oct 2019 10:54:59 +0000 (12:54 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 22 Oct 2019 15:57:52 +0000 (17:57 +0200)
This avoids a crash in InsetMathSplit which uses the buffer() value.

Fixes bug #11686.

(cherry picked from commit 19abf29ea0cf89cdc99b9327448146aeb35d1dc1)

src/mathed/InsetMathMacro.cpp
status.23x

index 5e72eecdc27850b4737e833593b420df9f9f4bdb..d354412edd15cd16507ae0961aaa34e909c77fec 100644 (file)
@@ -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();
        // 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);
        }
                if (utype == OutputUpdate && !d->expanded_.empty())
                        d->expanded_.updateMacros(cur, mc, utype, nesting);
        }
index e005d5eedc5b2e4b71fd8885650ed2cecc2fc213..bb1fd59f081e089328b47c3edfccfe22d8ce5bfc 100644 (file)
@@ -150,6 +150,8 @@ What's new
 
 - Fix bad caret position when row scrolls horizontally (bug 11603).
 
 
 - Fix bad caret position when row scrolls horizontally (bug 11603).
 
+- Fix crash when inserting some macros (bug 11686).
+
 
 * INTERNALS
 
 
 * INTERNALS