[LyX/master] Fix crash due to encoding issues with child doc
Scott Kostyshak
skostysh at lyx.org
Tue Dec 10 14:02:46 UTC 2019
commit c61472303e4ea1d59d1f26e9d4a516dd2c50feb2
Author: Scott Kostyshak <skostysh at lyx.org>
Date: Sun Dec 8 19:14:38 2019 -0500
Fix crash due to encoding issues with child doc
This crash occurred starting with 553bebc3, and can be triggered
when preview is enabled both in preferences and in a child document
inset. For a minimal example, see the following ML thread:
https://www.mail-archive.com/search?l=mid&q=20191209002609.6fao3dljtf3ohl25%40tallinn
This fix restores behavior to before that commit for the case when
oldEnc is 0.
---
src/insets/InsetInclude.cpp | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp
index 3cf3189..1bd1c5b 100755
--- a/src/insets/InsetInclude.cpp
+++ b/src/insets/InsetInclude.cpp
@@ -848,8 +848,11 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
Language const * const oldLang = runparams.master_language;
// If the master uses non-TeX fonts (XeTeX, LuaTeX),
// the children must be encoded in plain utf8!
- runparams.encoding = masterBuffer->params().useNonTeXFonts ?
- encodings.fromLyXName("utf8-plain") : oldEnc;
+ if (masterBuffer->params().useNonTeXFonts)
+ runparams.encoding = encodings.fromLyXName("utf8-plain");
+ else if (oldEnc)
+ runparams.encoding = oldEnc;
+ else runparams.encoding = &tmp->params().encoding();
runparams.master_language = buffer().params().language;
runparams.par_begin = 0;
runparams.par_end = tmp->paragraphs().size();
More information about the lyx-cvs
mailing list