diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 4290cbb710..eeefd6d4f1 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -260,6 +260,12 @@ void BufferView::Pimpl::setBuffer(Buffer * b) boost::tie(cursor_.pit(), cursor_.pos()) ); } + // If we're quitting lyx, don't bother updating stuff + if (quitting) { + buffer_ = 0; + return; + } + // If we are closing current buffer, switch to the first in // buffer list. if (!b) { @@ -277,10 +283,6 @@ void BufferView::Pimpl::setBuffer(Buffer * b) anchor_ref_ = 0; offset_ref_ = 0; - // If we're quitting lyx, don't bother updating stuff - if (quitting) - return; - if (buffer_) { lyxerr[Debug::INFO] << BOOST_CURRENT_FUNCTION << "Buffer addr: " << buffer_ << endl; diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index e9bcd1adc1..2abb0deee4 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -139,22 +139,19 @@ void LyXView::setBuffer(Buffer * b) work_area_->bufferView().setBuffer(b); - if (work_area_->bufferView().buffer()) - { + if (work_area_->bufferView().buffer()) { // Buffer-dependent dialogs should be updated or // hidden. This should go here because some dialogs (eg ToC) // require bv_->text. getDialogs().updateBufferDependent(true); + connectBuffer(*work_area_->bufferView().buffer()); + setLayout(work_area_->bufferView().firstLayout()); } updateMenubar(); updateToolbars(); updateLayoutChoice(); updateWindowTitle(); - if (b) { - connectBuffer(*b); - setLayout(work_area_->bufferView().firstLayout()); - } redrawWorkArea(); } diff --git a/src/frontends/WorkArea.C b/src/frontends/WorkArea.C index 6b1f61e66d..b47fae73d9 100644 --- a/src/frontends/WorkArea.C +++ b/src/frontends/WorkArea.C @@ -192,6 +192,7 @@ void WorkArea::redraw() if (!buffer_view_->buffer()) { greyOut(); + updateScrollbar(); return; } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 6cc001266b..2d1f1b65eb 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1611,13 +1611,14 @@ void LyXFunc::dispatch(FuncRequest const & cmd) && !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer) && !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly)) view()->buffer()->markDirty(); - } - if (view()->cursor().inTexted()) { - view()->owner()->updateLayoutChoice(); + if (view()->cursor().inTexted()) { + view()->owner()->updateLayoutChoice(); + } } } - sendDispatchMessage(_(getMessage()), cmd); + if (!quitting) + sendDispatchMessage(_(getMessage()), cmd); }