[LyX/master] Do not change font in html text without gui

Enrico Forestieri forenr at lyx.org
Sat Sep 23 10:29:29 UTC 2023


commit 12e3d46b5b99904c70ea665f61a795aaa4f3f948
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Sat Sep 23 13:41:26 2023 +0200

    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 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/Converter.cpp b/src/Converter.cpp
index b63f771..f9e627b 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 ? "<tt>" + conv_command + "</tt>"
+					   : conv_command;
 		docstring const shellescape_warning =
 		      bformat(_("<p>The following LaTeX backend has been "
 		        "configured to allow execution of external programs "
 		        "for any document:</p>"
-		        "<center><p><tt>%1$s</tt></p></center>"
+		        "<center><p>%1$s</p></center>"
 		        "<p>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.</p>"),
-		        from_utf8(conv_command));
+		        from_utf8(cmd));
 		frontend::Alert::error(_("Security Warning"),
 					shellescape_warning , false);
 	} else if (!conv.latex())


More information about the lyx-cvs mailing list