GtkCssProvider: free selector path on parse_rule().

This commit is contained in:
Carlos Garnacho 2010-04-21 01:51:46 +02:00
parent 07171d5f68
commit bc0af3208d

View File

@ -748,7 +748,8 @@ parse_selector (GtkCssProvider *css_provider,
{ {
SelectorPath *path; SelectorPath *path;
*selector_out = NULL; path = selector_path_new ();
*selector_out = path;
if (scanner->token != ':' && if (scanner->token != ':' &&
scanner->token != G_TOKEN_IDENTIFIER) scanner->token != G_TOKEN_IDENTIFIER)
@ -774,10 +775,7 @@ parse_selector (GtkCssProvider *css_provider,
g_scanner_get_next_token (scanner); g_scanner_get_next_token (scanner);
if ((token = parse_nth_child (css_provider, scanner, path, &flags)) != G_TOKEN_NONE) if ((token = parse_nth_child (css_provider, scanner, path, &flags)) != G_TOKEN_NONE)
{ return token;
selector_path_unref (path);
return token;
}
} }
selector_path_prepend_region (path, region_name, flags); selector_path_prepend_region (path, region_name, flags);
@ -786,10 +784,7 @@ parse_selector (GtkCssProvider *css_provider,
else if (scanner->value.v_identifier[0] == '*') else if (scanner->value.v_identifier[0] == '*')
selector_path_prepend_glob (path); selector_path_prepend_glob (path);
else else
{ return G_TOKEN_IDENTIFIER;
selector_path_unref (path);
return G_TOKEN_IDENTIFIER;
}
g_scanner_get_next_token (scanner); g_scanner_get_next_token (scanner);
@ -811,10 +806,7 @@ parse_selector (GtkCssProvider *css_provider,
g_scanner_get_next_token (scanner); g_scanner_get_next_token (scanner);
if (scanner->token != G_TOKEN_SYMBOL) if (scanner->token != G_TOKEN_SYMBOL)
{ return G_TOKEN_SYMBOL;
selector_path_unref (path);
return G_TOKEN_SYMBOL;
}
path->state = GPOINTER_TO_INT (scanner->value.v_symbol); path->state = GPOINTER_TO_INT (scanner->value.v_symbol);
@ -883,7 +875,10 @@ parse_rule (GtkCssProvider *css_provider,
expected_token = parse_selector (css_provider, scanner, &selector); expected_token = parse_selector (css_provider, scanner, &selector);
if (expected_token != G_TOKEN_NONE) if (expected_token != G_TOKEN_NONE)
return expected_token; {
selector_path_unref (selector);
return expected_token;
}
priv->cur_selectors = g_slist_prepend (priv->cur_selectors, selector); priv->cur_selectors = g_slist_prepend (priv->cur_selectors, selector);
@ -894,7 +889,10 @@ parse_rule (GtkCssProvider *css_provider,
expected_token = parse_selector (css_provider, scanner, &selector); expected_token = parse_selector (css_provider, scanner, &selector);
if (expected_token != G_TOKEN_NONE) if (expected_token != G_TOKEN_NONE)
return expected_token; {
selector_path_unref (selector);
return expected_token;
}
priv->cur_selectors = g_slist_prepend (priv->cur_selectors, selector); priv->cur_selectors = g_slist_prepend (priv->cur_selectors, selector);
} }