From: Scott Kostyshak Date: Mon, 9 Dec 2019 00:14:38 +0000 (-0500) Subject: Fix crash due to encoding issues with child doc X-Git-Tag: lyx-2.4.0dev-acb2ca7b~1441 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c61472303e4ea1d59d1f26e9d4a516dd2c50feb2;p=features.git 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. --- diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 3cf318906f..1bd1c5ba02 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();