[LyX/master] Fix #11520 Wrong inpute encoding when master and child use different setting.
Guenter Milde
milde at users.sf.net
Tue Dec 10 13:26:56 UTC 2019
On 2019-12-09, Scott Kostyshak wrote:
> On Mon, Mar 18, 2019 at 06:13:40PM +0100, Günter Milde wrote:
>> commit 553bebc3550f932ca3c25bbd4ae3905b60026b3c
>> Author: Günter Milde <milde at lyx.org>
>> Date: Mon Mar 18 18:16:40 2019 +0100
>> Fix #11520 Wrong inpute encoding when master and child use different setting.
>> ---
> I get a crash starting with this commit. To reproduce:
> 1. Save both of the attached files of this email to the same directory.
> 2. In LyX, turn instant preview to "on" in Preferences.
> 3. Open mwe.lyx.
> LyX gives a SIGSEGV on opening the file.
> Attached is a patch. I don't know if it makes sense. It attempts to keep
> the desired behavior of 553bebc3 except when oldEnc is 0. Günter can you
> have a look?
The patch looks good to me.
Thank you
Günter
> [-- Skipped Type: application/x-lyx, Filename: child_of_mwe.lyx --]
> [-- Skipped Type: application/x-lyx, Filename: mwe.lyx --]
> [-- Type: text/x-diff, Encoding: quoted-printable, Filename: 0001-Fix-crash-due-to-encoding-issues-with-child-doc.patch --]
> From 1f4164fbb12e78b5d2d9a579e5b75b980a035b80 Mon Sep 17 00:00:00 2001
> From: Scott Kostyshak <skostysh at lyx.org>
> Date: Sun, 8 Dec 2019 19:14:38 -0500
> Subject: [PATCH] Fix crash due to encoding issues with child doc
> This crash occured 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 my email sent to lyx-devel on
> 2019-12-08.
> This fix restores behavior to before that commit for the case when
> oldEnc is 0.
> ---
> src/insets/InsetInclude.cpp | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
> 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();
More information about the lyx-devel
mailing list