Commit 2dbaeef0 authored by Will Thompson's avatar Will Thompson 🐡 Committed by Alberto Fanjul

GladeProject: escape markup in parser errors

If you try to load a non-XML file, such as Glade's own README, the
parser error contains something like this:

    Start tag expected, '<' not found

glade_util_ui_message() treats the supplied message as markup; so the
literal < in the error message trips it up:

    Gtk-WARNING **: Failed to set text 'Error parsing file '/home/wjt/src/gnome/glade/README' on line 1
    Start tag expected, '<' not found
    ' from markup due to error parsing markup: Error on line 2 char 30: Odd character 'f', expected a '=' after attribute name 'not' of element '''

To fix this, escape the message before passing it to
glade_util_ui_message().
parent 8341cf78
Pipeline #68072 passed with stages
in 7 minutes and 27 seconds
......@@ -2105,7 +2105,9 @@ glade_project_load_internal (GladeProject *project)
if (message)
{
glade_util_ui_message (glade_app_get_window (), GLADE_UI_ERROR, NULL, "%s", message);
gchar *escaped = g_markup_escape_text (message, -1);
glade_util_ui_message (glade_app_get_window (), GLADE_UI_ERROR, NULL, "%s", escaped);
g_free (escaped);
g_free (message);
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment