From: Jean-Marc Lasgouttes Date: Tue, 14 Feb 2006 10:41:34 +0000 (+0000) Subject: bug 2060: Clicking on a macro in a math inset crashes LyX X-Git-Tag: 1.6.10~13600 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=7bb1fa55ac7780797bfbbeadaa0d3b0b8b426eea;p=features.git bug 2060: Clicking on a macro in a math inset crashes LyX git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13235 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 1561270548..ac4b0002f4 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,7 @@ +2006-02-13 Georg Baum + + * math_macro.C (editXY): Prevent crash (fix by Andrew Beck) + 2006-01-28 Lars Gullik Bjønnes * math_hullinset.C (getStatus): get rid of a compiler warning diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index 12682fad5e..a403edfc9c 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -129,8 +129,17 @@ void MathMacro::validate(LaTeXFeatures & features) const InsetBase * MathMacro::editXY(LCursor & cur, int x, int y) { // We may have 0 arguments, but MathNestInset requires at least one. - if (nargs() > 0) + if (nargs() > 0) { + // Prevent crash due to cold coordcache + // FIXME: This is only a workaround, the call of + // MathNestInset::editXY is correct. The correct fix would + // ensure that the coordcache of the arguments is valid. + if (!editing(&cur.bv())) { + edit(cur, true); + return this; + } return MathNestInset::editXY(cur, x, y); + } return this; }