[LyX/master] Fixup 216a6fb3: fix broken xml syntax

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue Jul 23 17:52:31 UTC 2024


commit a268fe096a58a7818554a7da4da85896bb289c81
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Tue Jul 23 15:04:49 2024 +0200

    Fixup 216a6fb3: fix broken xml syntax
    
    This commit addresses two issues:
    
    1/ the embarassing one: the member SetMode::old_text_level_ was
       declared as bool instead of int. This means that is was definitely
       not a proper backup variable!
    
    2/ a robustness issue: replace two consecutive test for isTest() by a
       boolean veriable that is used twice. This makes sure that <mrow>
       cannot be output without the corresponding </mrow>.
    
    Part of bug #13069.
---
 src/mathed/MathExtern.cpp | 6 ++++--
 src/mathed/MathStream.h   | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp
index 1f9356f8f2..990d35e9d2 100644
--- a/src/mathed/MathExtern.cpp
+++ b/src/mathed/MathExtern.cpp
@@ -1646,11 +1646,13 @@ void mathmlize(MathData const & dat, MathMLStream & ms)
 	} else if (ar.size() == 1) {
 		ms << ar.front();
 	} else {
-		if (!ms.inText())
+		// protect against the value changing in the second test.
+		bool const intext = ms.inText();
+		if (!intext)
 			ms << MTag("mrow");
 		for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
 			(*it)->mathmlize(ms);
-		if (!ms.inText())
+		if (!intext)
 			ms << ETag("mrow");
 	}
 }
diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h
index a9edae08c0..40bb7d3bfb 100644
--- a/src/mathed/MathStream.h
+++ b/src/mathed/MathStream.h
@@ -469,7 +469,7 @@ private:
 	///
 	MathMLStream & ms_;
 	///
-	bool old_text_level_;
+	int old_text_level_;
 };
 
 


More information about the lyx-cvs mailing list