This patch fixes the crash described in http://bugzilla.lyx.org/show_bug.cgi?id=1926
``Start a new doc, and start a math formula. Enter it, and leaving the cursor inside the formula, start another new doc. Move back to the old doc via the View menu and: Assertion triggered in Paragraph& DocIterator::paragraph() by failing check "inTexted()" in file dociterator.C:144'' Testing appreciated, although it seems trivially correct (I tried to use LFUN_GETLAYOUT but it (1) leaves the current math inset and (2) displays the result of the lfun in the minibuffer). JMarc
Index: src/BufferView_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v retrieving revision 1.594 diff -u -p -r1.594 BufferView_pimpl.C --- src/BufferView_pimpl.C 7 Sep 2005 10:00:17 -0000 1.594 +++ src/BufferView_pimpl.C 13 Sep 2005 15:21:25 -0000 @@ -386,8 +386,20 @@ void BufferView::Pimpl::setBuffer(Buffer owner_->updateWindowTitle(); // This is done after the layout combox has been populated - if (buffer_) - owner_->setLayout(cursor_.paragraph().layout()->name()); + if (buffer_) { + size_t i = cursor_.depth() - 1; + // we know we'll eventually find a paragraph + while (true) { + CursorSlice const & slice = cursor_[i]; + if (!slice.inset().inMathed()) { + LyXLayout_ptr const layout = slice.paragraph().layout(); + owner_->setLayout(layout->name()); + break; + } + BOOST_ASSERT(i>0); + --i; + } + } if (buffer_ && lyx::graphics::Previews::status() != LyXRC::PREVIEW_OFF) lyx::graphics::Previews::get().generateBufferPreviews(*buffer_); Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.2277 diff -u -p -r1.2277 ChangeLog --- src/ChangeLog 10 Sep 2005 13:29:43 -0000 1.2277 +++ src/ChangeLog 13 Sep 2005 15:21:26 -0000 @@ -1,3 +1,9 @@ +2005-09-13 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * BufferView_pimpl.C (setBuffer): when one wants to set the layout + combox, it is necessary to search for the topmost paragraph in the + cursor stack (bug 1926) + 2005-09-10 Georg Baum <[EMAIL PROTECTED]> * text.C (leftMargin): check for inInset == 0