The attached patch addresses this bug. The idea is to leave the TOC
(e.g.) open when closing one buffer, if there is still one open.

This seems slightly dangerous, so I won't push to commit this now,
though if people think it's a good idea and it seems safe, then we
could. For what it's worth, there is nearly identical code in
LyXFunc::closeBuffer():
void LyXFunc::closeBuffer()
{
    // 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()) { //NOTE THIS LINE
            // 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());
        }
    }
}
So I doubt the attached patch could cause any problems that aren't
already here. So if anyone thinks it's good for 1.5.0, let me know.

Richard

-- 
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Index: frontends/LyXView.cpp
===================================================================
--- frontends/LyXView.cpp	(revision 18504)
+++ frontends/LyXView.cpp	(working copy)
@@ -20,6 +20,8 @@
 #include "Gui.h"
 
 #include "Buffer.h"
+//FIXME Bug 3701
+#include "BufferList.h"
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "bufferview_funcs.h"
@@ -129,7 +131,8 @@
 	if (work_area_->bufferView().buffer())
 		disconnectBuffer();
 
-	if (!b)
+	//FIXME Bug 3701
+	if (!b && theBufferList().empty())
 		getDialogs().hideBufferDependent();
 
 	work_area_->bufferView().setBuffer(b);

Reply via email to