diff --git a/gtk/gtkcssreferencevalue.c b/gtk/gtkcssreferencevalue.c index 03f44b63ff..19092b2ca7 100644 --- a/gtk/gtkcssreferencevalue.c +++ b/gtk/gtkcssreferencevalue.c @@ -220,6 +220,8 @@ parser_error (GtkCssParser *parser, { for (int i = 0; i < n_vars; i++) { + GtkCssSection *section; + if (names[i + 1]) g_set_error (&new_error, GTK_CSS_PARSER_ERROR, GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE, @@ -228,7 +230,15 @@ parser_error (GtkCssParser *parser, g_set_error_literal (&new_error, GTK_CSS_PARSER_ERROR, GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE, error->message); - gtk_style_provider_emit_error (provider, vars[i]->section, new_error); + + if (vars[i]->section == NULL) + section = gtk_css_section_new (gtk_css_parser_get_file (parser), start, end); + else + section = gtk_css_section_ref (vars[i]->section); + + gtk_style_provider_emit_error (provider, section, new_error); + + gtk_css_section_unref (section); g_clear_error (&new_error); }