[glade/wjt/escape-parser-errors: 34/34] GladeProject: escape markup in parser errors
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/wjt/escape-parser-errors: 34/34] GladeProject: escape markup in parser errors
- Date: Wed, 13 Mar 2019 23:54:31 +0000 (UTC)
commit 2dbaeef0e8aaf095acc49d447c0105a938840f7c
Author: Will Thompson <will willthompson co uk>
Date: Tue Sep 18 14:30:18 2018 +0100
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().
gladeui/glade-project.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 670084e8..c8a1ddcb 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]