Add error func to node deserialization

This commit is contained in:
Timm Bäder
2019-04-24 18:30:46 +02:00
committed by Benjamin Otte
parent 5530331b35
commit dde69802cd
9 changed files with 102 additions and 33 deletions

View File

@@ -13,6 +13,19 @@ static GOptionEntry options[] = {
{ NULL }
};
static void
deserialize_error_func (const GtkCssSection *section,
const GError *error,
gpointer user_data)
{
char *section_str = gtk_css_section_to_string (section);
g_warning ("Error at %s: %s", section_str, error->message);
free (section_str);
}
int
main(int argc, char **argv)
{
@@ -66,7 +79,7 @@ main(int argc, char **argv)
}
start = g_get_monotonic_time ();
node = gsk_render_node_deserialize (bytes, &error);
node = gsk_render_node_deserialize (bytes, deserialize_error_func, NULL);
end = g_get_monotonic_time ();
if (benchmark)
{
@@ -78,8 +91,6 @@ main(int argc, char **argv)
if (node == NULL)
{
g_printerr ("Invalid node file: %s\n", error->message);
g_clear_error (&error);
return 1;
}