mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 21:16:15 +01:00
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
This commit is contained in:
parent
2b8f131599
commit
7f4fdb59aa
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user