mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bug 5785: http://bugzilla.lyx.org/show_bug.cgi?id=5785.
Reference dialog update crash for read-only documents. Comments: * -1 is a valid return of bufferCO->currentIndex() so we need to test for it. * set the correct enabling of the button in case no call to updateContents follows. * remove unneeded call to setFocusProxy. The widget is either disabled or the focus proxy is set in updateRefs. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28547 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
106adc4b42
commit
c85e24b066
@ -55,6 +55,12 @@ GuiRef::GuiRef(GuiView & lv)
|
||||
bufferCO->setEnabled(false);
|
||||
bufferCO->hide();
|
||||
|
||||
// Enabling is set in updateRefs. Disable for now in case no
|
||||
// call to updateContents follows (e.g. read-only documents).
|
||||
sortCB->setEnabled(false);
|
||||
refsLW->setEnabled(false);
|
||||
gotoPB->setEnabled(false);
|
||||
|
||||
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
||||
@ -82,8 +88,6 @@ GuiRef::GuiRef(GuiView & lv)
|
||||
connect(bufferCO, SIGNAL(activated(int)),
|
||||
this, SLOT(updateClicked()));
|
||||
|
||||
setFocusProxy(refsLW);
|
||||
|
||||
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
||||
bc().setOK(okPB);
|
||||
bc().setApply(applyPB);
|
||||
@ -361,9 +365,12 @@ void GuiRef::redoRefs()
|
||||
void GuiRef::updateRefs()
|
||||
{
|
||||
refs_.clear();
|
||||
FileName const & name = theBufferList().fileNames()[bufferCO->currentIndex()];
|
||||
Buffer const * buf = theBufferList().getBuffer(name);
|
||||
buf->getLabelList(refs_);
|
||||
int const the_buffer = bufferCO->currentIndex();
|
||||
if (the_buffer != -1) {
|
||||
FileName const & name = theBufferList().fileNames()[the_buffer];
|
||||
Buffer const * buf = theBufferList().getBuffer(name);
|
||||
buf->getLabelList(refs_);
|
||||
}
|
||||
sortCB->setEnabled(!refs_.empty());
|
||||
refsLW->setEnabled(!refs_.empty());
|
||||
// refsLW should only be the focus proxy when it is enabled
|
||||
|
Loading…
Reference in New Issue
Block a user