Use case: 1) Open doc1 2) scroll a bit 3) open doc2 4) close doc2
Bug: The cursor is not at last position of doc1 and the screen is not redrawn.
The fix is simple. The removed code is already done on Buffer deletion thanks to the Buffer::closing() signal connection to LyXView. Setting the Buffer twice was the reason of the bug.
OK? Abdel.
Index: LyXFunc.cpp =================================================================== --- LyXFunc.cpp (revision 18827) +++ LyXFunc.cpp (working copy) @@ -2089,16 +2089,8 @@ // goto bookmark to update bookmark pit. for (size_t i = 0; i < LyX::ref().session().bookmarks().size(); ++i) gotoBookmark(i+1, false, false); - if (theBufferList().close(lyx_view_->buffer(), true) && !quitting) { - if (theBufferList().empty()) { - // need this otherwise SEGV may occur while - // trying to set variables that don't exist - // since there's no current buffer - lyx_view_->getDialogs().hideBufferDependent(); - } else { - lyx_view_->setBuffer(theBufferList().first()); - } - } + + theBufferList().close(lyx_view_->buffer(), true); }