builder: Use GMarkup properly
authorMatthias Clasen <mclasen@redhat.com>
Tue, 14 Dec 2021 04:35:25 +0000 (23:35 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 14 Dec 2021 04:42:47 +0000 (23:42 -0500)
We must call end_parse to ensure we get errors
for incomplete documents.

gtk/gtkbuilderprecompile.c

index 0e613ad542909ccdae7a38c4a06decacd4dd5d86..74551bb62e9493af7eed60ff186201d7b3678fae 100644 (file)
@@ -321,10 +321,10 @@ _gtk_buildable_parser_precompile (const char  *text,
   data.root = record_data_tree_new (NULL, RECORD_TYPE_ELEMENT, NULL);
   data.current = data.root;
 
-  ctx = g_markup_parse_context_new (&record_parser, G_MARKUP_TREAT_CDATA_AS_TEXT,
-                                    &data, NULL);
+  ctx = g_markup_parse_context_new (&record_parser, G_MARKUP_TREAT_CDATA_AS_TEXT, &data, NULL);
 
-  if (!g_markup_parse_context_parse (ctx, text, text_len, error))
+  if (!g_markup_parse_context_parse (ctx, text, text_len, error) ||
+      !g_markup_parse_context_end_parse (ctx, error))
     {
       record_data_tree_free (data.root);
       g_hash_table_destroy (data.strings);