]> git.lyx.org Git - features.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>
Sun, 20 Oct 2019 10:54:59 +0000 (12:54 +0200)
This avoids a crash in InsetMathSplit which uses the buffer() value.

Fixes bug #11686.

src/mathed/InsetMathMacro.cpp

index b5b0322a540c2d9f08238c4a21bbc74d156b5373..6e8ea5c30b1343d20de60fd1cefbf80c359a40c7 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();
-       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);
        }