From 0c5d898d43ad6b544142c76655b800219a27e488 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 16 Oct 2000 16:15:32 +0000 Subject: [PATCH] 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 --- ChangeLog | 10 ++++++++++ src/insets/insetbib.C | 13 ++++++++++--- src/mathed/math_macro.C | 6 ++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b163fb2ac4..a4bb9b1bc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-10-16 Jean-Marc Lasgouttes + + * src/mathed/math_macro.C (MathMacroTemplate): initialize args to + 0 when there are no arguments. + +2000-10-16 Angus Leeming + + * 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 * forms/layout_forms.fd: diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index 330c453e34..1ea8b95d3f 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -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 (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); diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index 3f88d47907..2ddc24d13d 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -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; + } } -- 2.39.2