GMarkup: clear attributes on ignorned tags
authorRyan Lortie <desrt@desrt.ca>
Tue, 29 Oct 2013 16:01:32 +0000 (09:01 -0700)
committerRyan Lortie <desrt@desrt.ca>
Tue, 29 Oct 2013 16:37:06 +0000 (09:37 -0700)
Make sure that if we ignore a tag then we also clear the attributes that
we already collected so that they don't end up on the next unignored tag
opening.

Also add some extra brackets for clarity (it doesn't make any difference
-- I just think it reads nicer this way).

https://bugzilla.gnome.org/show_bug.cgi?id=665634

glib/gmarkup.c

index f27bb3b..89404e5 100644 (file)
@@ -1016,10 +1016,11 @@ emit_start_element (GMarkupParseContext  *context,
    *
    * We deal with the end of the subparser from emit_end_element.
    */
-  if (context->flags & G_MARKUP_IGNORE_QUALIFIED && strchr (current_element (context), ':'))
+  if ((context->flags & G_MARKUP_IGNORE_QUALIFIED) && strchr (current_element (context), ':'))
     {
       static const GMarkupParser ignore_parser;
       g_markup_parse_context_push (context, &ignore_parser, NULL);
+      clear_attributes (context);
       return;
     }
 
@@ -1070,7 +1071,7 @@ emit_end_element (GMarkupParseContext  *context,
   possibly_finish_subparser (context);
 
   /* We might have just returned from our ignore subparser */
-  if (context->flags & G_MARKUP_IGNORE_QUALIFIED && strchr (current_element (context), ':'))
+  if ((context->flags & G_MARKUP_IGNORE_QUALIFIED) && strchr (current_element (context), ':'))
     {
       g_markup_parse_context_pop (context);
       pop_tag (context);