Bibtex fix from Angus ; first try at fixing mathed crash

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1125 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-10-16 16:15:32 +00:00
parent 4255b4a1b7
commit 0c5d898d43
3 changed files with 24 additions and 5 deletions

View File

@ -1,3 +1,13 @@
2000-10-16 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/mathed/math_macro.C (MathMacroTemplate): initialize args to
0 when there are no arguments.
2000-10-16 Angus Leeming <a.leeming@ic.ac.uk>
* src/insets/insetbib.C: re-introduce current_view as a temporary fix
to segfaults when pressing Ok in InsetBibtex dialog.
2000-10-16 Angus Leeming <a.leeming@ic.ac.uk>
* forms/layout_forms.fd:

View File

@ -31,14 +31,18 @@ FD_bibitem_form * bibitem_form = 0;
FD_bibitem_form * create_form_bibitem_form(void);
extern BufferView * current_view;
// This is foul!
// called from both InsetBibKey and InsetBibtex dialogs yet cast off
// only to InsetBibKey holder. Real problems can ensue.
extern "C"
void bibitem_cb(FL_OBJECT *, long data)
{
InsetBibKey::Holder * holder =
static_cast<InsetBibKey::Holder*>
(bibitem_form->bibitem_form->u_vdata);
holder->inset->callback( bibitem_form, data );
}
@ -99,12 +103,15 @@ void InsetBibKey::callback( FD_bibitem_form * form, long data )
{
switch (data) {
case 1:
if(!holder.view->buffer()->isReadonly()) {
// Do NOT change this to
// holder.view->buffer() as this code is used by both
// InsetBibKey and InsetBibtex! Ughhhhhhh!!!!
if(!current_view->buffer()->isReadonly()) {
setContents(fl_get_input(form->key));
setOptions(fl_get_input(form->label));
// shouldn't mark the buffer dirty unless
// something was actually altered
holder.view->updateInset( this, true );
current_view->updateInset( this, true );
} // fall through to Cancel
case 0:
fl_hide_form(form->bibitem_form);

View File

@ -265,8 +265,10 @@ MathMacroTemplate::MathMacroTemplate(string const & nm, int na, int flg):
for (int i = 0; i < nargs; ++i) {
args[i].setNumber(i + 1);
}
} else
tcode = LM_TC_INSET;
} else {
tcode = LM_TC_INSET;
args = 0;
}
}