http://bugzilla.lyx.org/show_bug.cgi?id=3488

The attached patch resolves this bug. The problem was that the current
buffer was being disconnected from the LyXView before the new buffer was
loaded. If the load failed, then, closing the current buffer would not
call LyXView::setBuffer(), and the `current buffer' would then be undefined.

Seeking two OKs....

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 18489)
+++ frontends/LyXView.cpp	(working copy)
@@ -163,10 +163,12 @@
 	busy(true);
 
 	BOOST_ASSERT(work_area_);
-	if (work_area_->bufferView().buffer())
+	bool const hadBuffer = work_area_->bufferView().buffer();
+	if (hadBuffer)
 		disconnectBuffer();
 
-	bool loaded = work_area_->bufferView().loadLyXFile(filename, tolastfiles);
+	bool const loaded = 
+		work_area_->bufferView().loadLyXFile(filename, tolastfiles);
 
 	updateToc();
 	updateMenubar();
@@ -177,7 +179,9 @@
 	if (loaded) {
 		connectBuffer(*work_area_->bufferView().buffer());
 		showErrorList("Parse");
-	}
+	} else if (hadBuffer)
+		//Need to reconnect the buffer if the load failed
+		connectBuffer(*work_area_->bufferView().buffer());
 	updateStatusBar();
 	busy(false);
 	work_area_->redraw();

Reply via email to