The reason is simple: LyX inserts a hyphenation-inset, which is simply invalid in mathed (and hence drawn outside). This confuses undo.
Simple fix: disable the specialchar insets in mathed (see attached patch). Also a candidate for 1.4. (same crashes) However, in math-text mode, lots of these lfuns would make sense, so they could be implemented later (for instance, \- or even \textcompwordmark in math-text seems to do the right thing; I've added a FIXME). OK to apply? Jürgen
Index: src/mathed/InsetMathNest.cpp =================================================================== --- src/mathed/InsetMathNest.cpp (Revision 18346) +++ src/mathed/InsetMathNest.cpp (Arbeitskopie) @@ -1089,6 +1089,15 @@ flag.enabled(cur.selBegin().idx() == cur.selEnd().idx()); break; + case LFUN_HYPHENATION_POINT_INSERT: + case LFUN_LIGATURE_BREAK_INSERT: + case LFUN_MENU_SEPARATOR_INSERT: + case LFUN_DOTS_INSERT: + case LFUN_END_OF_SENTENCE_PERIOD_INSERT: + // FIXME: These would probably make sense in math-text mode + flag.enabled(false); + break; + default: ret = false; break;