>>>>> "Sami" == Sami Hanhijärvi <[EMAIL PROTECTED]> writes:

Sami> Hi, I downloaded and compiled the 1.4.0pre3 version of LyX. When
Sami> I opened a lyx file, the math macros are loaded empty; with no
Sami> name nor content. If I save the document, the lyx file will also
Sami> have empty math macros. A work around is to close the file
Sami> without saving and reload it.

I think this bug is fixed now. If it is what I think it is is, it does
not occur when there is a normal formula before the first math macro.
I committed the following fix yesterday.

Does it help?

JMarc

Index: src/mathed/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.541
diff -u -p -r1.541 ChangeLog
--- src/mathed/ChangeLog	11 Jan 2006 17:08:50 -0000	1.541
+++ src/mathed/ChangeLog	18 Jan 2006 17:45:52 -0000
@@ -1,3 +1,11 @@
+2006-01-18  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* math_factory.C (initMath): set initialized to true early to
+	avoid recursive invokation.
+
+	* math_macrotemplate.C (MathMacroTemplate): make sure math
+	structures are initialized.
+
 2006-01-11  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* math_nestinset.C (doDispatch/LFUN_SELFINSERT): when inserting a
Index: src/mathed/math_factory.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_factory.C,v
retrieving revision 1.114
diff -u -p -r1.114 math_factory.C
--- src/mathed/math_factory.C	26 Jul 2005 14:28:45 -0000	1.114
+++ src/mathed/math_factory.C	18 Jan 2006 17:45:52 -0000
@@ -225,9 +225,9 @@ void initMath()
 {
 	static bool initialized = false;
 	if (!initialized) {
+		initialized = true;
 		initParser();
 		initSymbols();
-		initialized = true;
 	}
 }
 
Index: src/mathed/math_macrotemplate.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_macrotemplate.C,v
retrieving revision 1.71
diff -u -p -r1.71 math_macrotemplate.C
--- src/mathed/math_macrotemplate.C	23 Nov 2004 23:04:51 -0000	1.71
+++ src/mathed/math_macrotemplate.C	18 Jan 2006 17:45:52 -0000
@@ -36,13 +36,17 @@ using std::endl;
 
 MathMacroTemplate::MathMacroTemplate()
 	: MathNestInset(2), numargs_(0), name_(), type_("newcommand")
-{}
+{
+	initMath();
+}
 
 
 MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs,
 		string const & type, MathArray const & ar1, MathArray const & ar2)
 	: MathNestInset(2), numargs_(numargs), name_(nm), type_(type)
 {
+	initMath();
+
 	if (numargs_ > 9)
 		lyxerr << "MathMacroTemplate::MathMacroTemplate: wrong # of arguments: "
 			<< numargs_ << std::endl;
@@ -54,6 +58,8 @@ MathMacroTemplate::MathMacroTemplate(str
 MathMacroTemplate::MathMacroTemplate(std::istream & is)
 	: MathNestInset(2), numargs_(0), name_()
 {
+	initMath();
+
 	MathArray ar;
 	mathed_parse_cell(ar, is);
 	if (ar.size() != 1 || !ar[0]->asMacroTemplate()) {

Reply via email to