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
This commit is contained in:
Jean-Marc Lasgouttes 2006-02-14 10:41:34 +00:00
parent 33381332fc
commit 7bb1fa55ac
2 changed files with 14 additions and 1 deletions

View 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

View 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;
}