Fix bug 4335:

http://bugzilla.lyx.org/show_bug.cgi?id=4335

I say "assertion" in status.15x because the crash happens only in debug mode. Of course, as assertion are enabled in the Windows packages these are equivalent to crashes...


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@21528 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-11-09 10:06:09 +00:00
parent a98d01d9ca
commit dd172d53ed
2 changed files with 15 additions and 8 deletions

View File

@ -143,18 +143,22 @@ namespace {
#endif #endif
cur.insert(new InsetMathHull(hullSimple)); cur.insert(new InsetMathHull(hullSimple));
BOOST_ASSERT(old_pos == cur.pos()); BOOST_ASSERT(old_pos == cur.pos());
cur.nextInset()->edit(cur, true); Inset * inset = cur.nextInset();
inset->edit(cur, true);
// don't do that also for LFUN_MATH_MODE // don't do that also for LFUN_MATH_MODE
// unless you want end up with always changing // unless you want end up with always changing
// to mathrm when opening an inlined inset -- // to mathrm when opening an inlined inset --
// I really hate "LyXfunc overloading"... // I really hate "LyXfunc overloading"...
if (display) if (display) {
cur.dispatch(FuncRequest(LFUN_MATH_DISPLAY)); FuncRequest cmdm(LFUN_MATH_DISPLAY);
inset->dispatch(cur, cmdm);
}
// Avoid an unnecessary undo step if cmd.argument // Avoid an unnecessary undo step if cmd.argument
// is empty // is empty
if (!cmd.argument().empty()) if (!cmd.argument().empty()) {
cur.dispatch(FuncRequest(LFUN_MATH_INSERT, FuncRequest cmdm(LFUN_MATH_INSERT, cmd.argument());
cmd.argument())); inset->dispatch(cur, cmdm);
}
} else { } else {
// create a macro if we see "\\newcommand" // create a macro if we see "\\newcommand"
// somewhere, and an ordinary formula // somewhere, and an ordinary formula
@ -1372,10 +1376,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
// should be used (but it asserts with Bidi enabled) // should be used (but it asserts with Bidi enabled)
// cf. http://bugzilla.lyx.org/show_bug.cgi?id=4055 // cf. http://bugzilla.lyx.org/show_bug.cgi?id=4055
// cap::replaceSelection(cur); // cap::replaceSelection(cur);
cur.insert(new InsetMathHull(hullSimple)); InsetMathHull * inset = new InsetMathHull(hullSimple);
cur.insert(inset);
checkAndActivateInset(cur, true); checkAndActivateInset(cur, true);
BOOST_ASSERT(cur.inMathed()); BOOST_ASSERT(cur.inMathed());
cur.dispatch(cmd); inset->dispatch(cur, cmd);
break; break;
} }

View File

@ -103,6 +103,8 @@ What's new
- Fix a crash when using the outline-* lfuns within mathed (bug 4330). - Fix a crash when using the outline-* lfuns within mathed (bug 4330).
- Fix an assertion when entering a math object in a list environment (bug 4335).
- Correctly adjust screen fonts after the zoom or dpi settings were changed in - Correctly adjust screen fonts after the zoom or dpi settings were changed in
the preferences (Mac and Windows only) (bug 4268). the preferences (Mac and Windows only) (bug 4268).