[LyX/2.3.x] Fix crash with polyglossia and intitle commands when lang_auto_end is false

Juergen Spitzmueller spitz at lyx.org
Thu Nov 21 08:25:15 UTC 2019


commit 631e42f68be87b2315a1cf74ef64b2927fb3ef25
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Thu Nov 21 08:38:21 2019 +0100

    Fix crash with polyglossia and intitle commands when lang_auto_end is false
    
    (cherry picked from commit ed44bc9b12c0385eccf9323159365ae96b1b4f19)
---
 src/output_latex.cpp |   12 +++++++++++-
 status.23x           |    3 +++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 24e5b7f..26a0357 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -749,6 +749,10 @@ void TeXOnePar(Buffer const & buf,
 		? 0 : &paragraphs.at(pit + 1);
 
 	bool const intitle_command = style.intitle && style.latextype == LATEX_COMMAND;
+	// Intitle commands switch languages locally, thus increase
+	// language nesting level
+	if (intitle_command)
+		state->nest_level_ += 1;
 
 	if (style.pass_thru) {
 		Font const outerfont = text.outerFont(pit);
@@ -1367,6 +1371,10 @@ void TeXOnePar(Buffer const & buf,
 		}
 	}
 
+	// Reset language nesting level after intitle command
+	if (intitle_command)
+		state->nest_level_ -= 1;
+
 	LYXERR(Debug::LATEX, "TeXOnePar for paragraph " << pit << " done; ptr "
 		<< &par << " next " << nextpar);
 
@@ -1556,7 +1564,9 @@ void latexParagraphs(Buffer const & buf,
 					"$$lang",
 					mainlang))
 			<< '\n';
-		if (using_begin_end)
+		// If we have language_auto_begin, the stack will
+		// already be empty, nothing to pop()
+		if (using_begin_end && !lyxrc.language_auto_begin)
 			popLanguageName();
 	}
 
diff --git a/status.23x b/status.23x
index ad14991..d037d09 100644
--- a/status.23x
+++ b/status.23x
@@ -61,6 +61,9 @@ What's new
 
 - Prevent crash due to unencodable path (bug 11688).
 
+- Fix crash with polyglossia when the "Auto End" language preference setting
+  is off and titles are used.
+
 - (Re-)fix problems with activated equal sign and graphic options in Turkish
   and Latin documents (bug 2005).
 


More information about the lyx-cvs mailing list