Lars Gullik Bjønnes wrote:

> Ok.

It is in. That leaves only one open bug marked for 1.4.0: Crash when
clicking on a math macro, http://bugzilla.lyx.org/show_bug.cgi?id=2060. I
fixed that for the 0 arguemnts case, but Andrew Beck found out that it
happens for 1 and more arguments, too.
He sent a fix that is IMO not the final solution (the cursor is always in
the first argument cell regardless where you click), but it is still better
than a crash. Since the proper solution is not trivial, I propose to apply
this version, which I amended with a comment.
Is it OK to go in? Or shall we leave this bug open until someone comes up
with the right fix?


Georg
Index: src/mathed/ChangeLog
===================================================================
--- src/mathed/ChangeLog	(Revision 13226)
+++ src/mathed/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,7 @@
+2006-02-13  Georg Baum  <[EMAIL PROTECTED]>
+
+	* math_macro.C (editXY): Prevent crash (fix by Andrew Beck)
+
 2006-01-28  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
 	* math_hullinset.C (getStatus): get rid of a compiler warning
Index: src/mathed/math_macro.C
===================================================================
--- src/mathed/math_macro.C	(Revision 13226)
+++ src/mathed/math_macro.C	(Arbeitskopie)
@@ -129,8 +129,17 @@ void MathMacro::validate(LaTeXFeatures &
 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;
 }
 

Reply via email to