Probably this goes better into the right direction (using DocIterator instances, not unneeded Cursor ones), but the SEGFAULT is still there.
t.
Index: src/lyxfindadv.cpp =================================================================== --- src/lyxfindadv.cpp (revisione 27242) +++ src/lyxfindadv.cpp (copia locale) @@ -435,7 +435,7 @@ } } - CursorSlice cs = cur.top(); + CursorSlice const & cs = cur.top(); MathData md = cs.cell(); MathData::const_iterator it_end = ( ( len == -1 || cs.pos() + len > int(md.size()) ) ? md.end() : md.begin() + cs.pos() + len ); for (MathData::const_iterator it = md.begin() + cs.pos(); it != it_end; ++it) @@ -476,11 +476,11 @@ LYXERR(Debug::DEBUG, "Forwarding one step (searching for innermost match)" << std::endl); d = cur.depth(); old_cur = cur; - cur.forwardPos(); + cur.forwardChar(); } while (cur && cur.depth() > d && match(cur) > 0); if (! cur.empty()) { LYXERR(Debug::DEBUG, "Backwarding one step" << std::endl); - cur.backwardPos(); + cur.backwardChar(); } BOOST_ASSERT(match(cur) > 0); // if (! match(cur)) { @@ -508,7 +508,7 @@ } /// Finds forward -int findForwardAdv(Cursor & cur, MatchStringAdv const & match) { +int findForwardAdv(DocIterator & cur, MatchStringAdv const & match) { if (! cur) return 0; for (; cur; cur.forwardChar()) { @@ -522,7 +522,7 @@ } /// Finds backwards -int findBackwardsAdv(Cursor & cur, MatchStringAdv const & match) { +int findBackwardsAdv(DocIterator & cur, MatchStringAdv const & match) { // if (cur.pos() > 0 || cur.depth() > 0) // cur.backwardChar(); DocIterator cur_orig(cur); @@ -541,7 +541,7 @@ old_cur = cur; cur.backwardChar(); } while (cur && cur.pit() == pit && match(cur)); - cur.setCursor(old_cur); + cur = old_cur; DocIterator cur_foremost(cur); int len = findAdvFinalize(cur_foremost, match); LYXERR(Debug::DEBUG, "cur_orig : " << cur_orig); @@ -585,7 +585,7 @@ /// Perform a FindAdv operation. bool findAdv(BufferView * bv, FindAdvOptions const & opt) { - Cursor cur = bv->cursor(); + DocIterator cur = bv->cursor(); int match_len = 0; if (opt.search.empty()) { @@ -614,7 +614,7 @@ return false; } - LYXERR(Debug::DEBUG, "Setting selection with len: " << match_len << std::endl); + LYXERR(Debug::DEBUG, "Putting selection at " << cur << " with len: " << match_len << std::endl); bv->putSelectionAt(cur, match_len, ! opt.forward); bv->message(_("Match found !")); //bv->update();