[glib] gsettings: fix schema compiler error handling
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gsettings: fix schema compiler error handling
- Date: Thu, 9 Apr 2015 02:36:10 +0000 (UTC)
commit 7f4fdb59aa6963a066e251063dc6b7cfb766fdfe
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Apr 8 22:08:13 2015 -0400
gsettings: fix schema compiler error handling
Fix a couple of issues in error handling in glib-compile-schemas.
The first problem is that, in case of repeated <summary> or
<description> tags we were still allocating a GString which was never
being freed (due to the throwing of the error resulting in immediate
termination of the parse).
The second problem is that if the repeated <summary> tag also had
attributes, we would attempt to set the GError twice.
https://bugzilla.gnome.org/show_bug.cgi?id=747542
gio/glib-compile-schemas.c | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c
index a09ceae..2b3e0de 100644
--- a/gio/glib-compile-schemas.c
+++ b/gio/glib-compile-schemas.c
@@ -1383,27 +1383,33 @@ start_element (GMarkupParseContext *context,
else if (strcmp (element_name, "summary") == 0)
{
- if (state->key_state->summary_seen && state->strict)
- g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
- _("Only one <%s> element allowed inside <%s>"),
- element_name, container);
- state->key_state->summary_seen = TRUE;
-
if (NO_ATTRS ())
- state->string = g_string_new (NULL);
+ {
+ if (state->key_state->summary_seen && state->strict)
+ g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+ _("Only one <%s> element allowed inside <%s>"),
+ element_name, container);
+ else
+ state->string = g_string_new (NULL);
+
+ state->key_state->summary_seen = TRUE;
+ }
return;
}
else if (strcmp (element_name, "description") == 0)
{
- if (state->key_state->description_seen && state->strict)
- g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
- _("Only one <%s> element allowed inside <%s>"),
- element_name, container);
- state->key_state->description_seen = TRUE;
-
if (NO_ATTRS ())
- state->string = g_string_new (NULL);
+ {
+ if (state->key_state->description_seen && state->strict)
+ g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+ _("Only one <%s> element allowed inside <%s>"),
+ element_name, container);
+ else
+ state->string = g_string_new (NULL);
+
+ state->key_state->description_seen = TRUE;
+ }
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]