From 12e3d46b5b99904c70ea665f61a795aaa4f3f948 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Sat, 23 Sep 2023 13:41:26 +0200 Subject: [PATCH] Do not change font in html text without gui As reported here: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg220399.html if an alert is displayed when the gui is not available Qt6 crashes when the text contains html directives and the font is changed. --- src/Converter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Converter.cpp b/src/Converter.cpp index b63f77146a..f9e627bf86 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -311,16 +311,19 @@ bool Converters::checkAuth(Converter const & conv, string const & doc_fname, bool const has_shell_escape = contains(conv_command, "-shell-escape") || contains(conv_command, "-enable-write18"); if (conv.latex() && has_shell_escape && !use_shell_escape) { + // Only change font if gui is available otherwise Qt6 crashes + string const cmd = use_gui ? "" + conv_command + "" + : conv_command; docstring const shellescape_warning = bformat(_("

The following LaTeX backend has been " "configured to allow execution of external programs " "for any document:

" - "

%1$s

" + "

%1$s

" "

This is a dangerous configuration. Please, " "consider using the support offered by LyX for " "allowing this privilege only to documents that " "actually need it, instead.

"), - from_utf8(conv_command)); + from_utf8(cmd)); frontend::Alert::error(_("Security Warning"), shellescape_warning , false); } else if (!conv.latex())