mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
Fix crash on exit after a Buffer switch.
Log: * lyxfunc.C: - LyXFunc::dispatch(): put some save guards before using BufferView::cursor() and sendDispatchMessage(). * BufferView_pimpl.C - BufferView::Pimpl::setBuffer(): return before if exiting. * WorkArea.C: - WorkArea::redraw(): update the toolbar when greying out. * LyXView.C: - LyXView::setBuffer(): sanitization git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14815 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c46e1bdc9a
commit
83eb07fc4b
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -192,6 +192,7 @@ void WorkArea::redraw()
|
||||
|
||||
if (!buffer_view_->buffer()) {
|
||||
greyOut();
|
||||
updateScrollbar();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user