From af8cec47e97010854355f45350004ce67ad6c203 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 20 Jan 2012 10:44:07 +0000 Subject: [PATCH] Fix crash due to the attempt to access paragraph() from within mathed while doing forward-search (bug #7992). This should go to branch as well. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40636 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 964c445ced..3198e03107 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -3659,9 +3659,14 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr) command = lyxrc.forward_search_pdf; } - int row = doc_buffer->texrow().getRowFromIdPos(bv->cursor().paragraph().id(), bv->cursor().pos()); + DocIterator tmpcur = bv->cursor(); + // Leave math first + while (tmpcur.inMathed()) + tmpcur.pop_back(); + int row = tmpcur.inMathed() ? 0 : doc_buffer->texrow().getRowFromIdPos( + tmpcur.paragraph().id(), tmpcur.pos()); LYXERR(Debug::ACTION, "Forward search: row:" << row - << " id:" << bv->cursor().paragraph().id()); + << " id:" << tmpcur.paragraph().id()); if (!row || command.empty()) { dr.setMessage(_("Couldn't proceed.")); break; -- 2.39.2