]> git.lyx.org Git - features.git/commitdiff
Bibtex fix from Angus ; first try at fixing mathed crash
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 16 Oct 2000 16:15:32 +0000 (16:15 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 16 Oct 2000 16:15:32 +0000 (16:15 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1125 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/insets/insetbib.C
src/mathed/math_macro.C

index b163fb2ac49888bbf61107c27479702bca703659..a4bb9b1bc79232c9d9e4afde23b0904a0045d250 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
index 330c453e34497bc515588c359587a537f9eff780..1ea8b95d3fabbdd57250a4ebaab20bc41b083d14 100644 (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);
index 3f88d4790758a8586d9fbdac420b639e62cf57f9..2ddc24d13de846a5f4b7338648cc55ac955e1343 100644 (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;
+    }
 }