Fix for bug 3488. Need to reconnect buffer if load of new buffer fails. Also added comments regarding possible fix for bug 3701.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18526 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2007-05-26 17:38:26 +00:00
parent 274b6182f3
commit 431caa02e3

View File

@ -20,6 +20,8 @@
#include "Gui.h" #include "Gui.h"
#include "Buffer.h" #include "Buffer.h"
//FIXME Bug 3701
//#include "BufferList.h"
#include "BufferParams.h" #include "BufferParams.h"
#include "BufferView.h" #include "BufferView.h"
#include "bufferview_funcs.h" #include "bufferview_funcs.h"
@ -129,7 +131,8 @@ void LyXView::setBuffer(Buffer * b)
if (work_area_->bufferView().buffer()) if (work_area_->bufferView().buffer())
disconnectBuffer(); disconnectBuffer();
if (!b) //FIXME Bug 3701
if (!b) // && theBufferList().empty()
getDialogs().hideBufferDependent(); getDialogs().hideBufferDependent();
work_area_->bufferView().setBuffer(b); work_area_->bufferView().setBuffer(b);
@ -163,10 +166,12 @@ bool LyXView::loadLyXFile(FileName const & filename, bool tolastfiles)
busy(true); busy(true);
BOOST_ASSERT(work_area_); BOOST_ASSERT(work_area_);
if (work_area_->bufferView().buffer()) bool const hadBuffer = work_area_->bufferView().buffer();
if (hadBuffer)
disconnectBuffer(); disconnectBuffer();
bool loaded = work_area_->bufferView().loadLyXFile(filename, tolastfiles); bool const loaded =
work_area_->bufferView().loadLyXFile(filename, tolastfiles);
updateToc(); updateToc();
updateMenubar(); updateMenubar();
@ -177,7 +182,9 @@ bool LyXView::loadLyXFile(FileName const & filename, bool tolastfiles)
if (loaded) { if (loaded) {
connectBuffer(*work_area_->bufferView().buffer()); connectBuffer(*work_area_->bufferView().buffer());
showErrorList("Parse"); showErrorList("Parse");
} } else if (hadBuffer)
//Need to reconnect the buffer if the load failed
connectBuffer(*work_area_->bufferView().buffer());
updateStatusBar(); updateStatusBar();
busy(false); busy(false);
work_area_->redraw(); work_area_->redraw();