]> git.lyx.org Git - features.git/commitdiff
bug 2060: Clicking on a macro in a math inset crashes LyX
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 14 Feb 2006 10:41:34 +0000 (10:41 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 14 Feb 2006 10:41:34 +0000 (10:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13235 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/math_macro.C

index 15612705486b2ffb52ee16682a4a1d1cdbefb659..ac4b0002f451942c661f55224a8f0ec2326a0300 100644 (file)
@@ -1,3 +1,7 @@
+2006-02-13  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
+
+       * math_macro.C (editXY): Prevent crash (fix by Andrew Beck)
+
 2006-01-28  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
        * math_hullinset.C (getStatus): get rid of a compiler warning
index 12682fad5e391246de35a4a7bf118f9796953278..a403edfc9c1ddf6569ed07dd8b4b9a95a5ff5c62 100644 (file)
@@ -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;
 }