Juergen Spitzmueller wrote: > Abdelrazak Younes wrote: > > I think the coordCache is guilty of most (all?) the crashes we see > > either on trunk or in 1.4.2. This concept is very fragile. > > OK. The problem is that I cannot reproduce most of the crashes yet. If I > can, I'll check if your patch improves things.
It does not fix the crashes I can reproduce (not surprised, since those seem to be graphics-related). FWIW, attached is the patch against 1.4.3svn for reference. Jürgen
Index: src/rowpainter.C =================================================================== --- src/rowpainter.C (Revision 14442) +++ src/rowpainter.C (Arbeitskopie) @@ -788,11 +788,14 @@ void paintPar static PainterInfo nullpi(pi.base.bv, nop); int const ww = pi.base.bv->workHeight(); + theCoords.parPos()[&text][pit] = Point(x, y); + Paragraph const & par = text.paragraphs()[pit]; + if (par.rows().empty()) + return; RowList::const_iterator const rb = par.rows().begin(); RowList::const_iterator const re = par.rows().end(); - theCoords.parPos()[&text][pit] = Point(x, y); y -= rb->ascent(); lyx::size_type rowno(0); Index: src/bufferview_funcs.C =================================================================== --- src/bufferview_funcs.C (Revision 14442) +++ src/bufferview_funcs.C (Arbeitskopie) @@ -201,8 +201,12 @@ Point coordOffset(DocIterator const & di Point getPos(DocIterator const & dit, bool boundary) { CursorSlice const & bot = dit.bottom(); - CoordCache::InnerParPosCache const & cache = - theCoords.getParPos().find(bot.text())->second; + CoordCache::ParPosCache::const_iterator cache_it = + theCoords.getParPos().find(bot.text()); + if (cache_it == theCoords.getParPos().end()) + return Point(-1, -1); + + CoordCache::InnerParPosCache const & cache = cache_it->second; CoordCache::InnerParPosCache::const_iterator it = cache.find(bot.pit()); if (it == cache.end()) { //lyxerr << "cursor out of view" << std::endl; Index: src/text.C =================================================================== --- src/text.C (Revision 14442) +++ src/text.C (Arbeitskopie) @@ -2235,6 +2235,9 @@ int LyXText::cursorY(CursorSlice const & { //lyxerr << "LyXText::cursorY: boundary: " << boundary << std::endl; Paragraph const & par = getPar(sl.pit()); + if (par.rows().empty()) + return 0; + int h = 0; h -= pars_[0].rows()[0].ascent(); for (pit_type pit = 0; pit < sl.pit(); ++pit)