theme-node: Fix leak on stylesheet change.
on_custom_stylesheet_changed() would set properties_computed to FALSE without freeing the old properties, then the properties pointer would be overwritten in ensure_properties(). https://bugzilla.gnome.org/show_bug.cgi?id=710230
This commit is contained in:
parent
8954d99659
commit
90596b0964
@ -66,11 +66,30 @@ st_theme_node_class_init (StThemeNodeClass *klass)
|
|||||||
object_class->finalize = st_theme_node_finalize;
|
object_class->finalize = st_theme_node_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
maybe_free_properties (StThemeNode *node)
|
||||||
|
{
|
||||||
|
if (node->properties)
|
||||||
|
{
|
||||||
|
g_free (node->properties);
|
||||||
|
node->properties = NULL;
|
||||||
|
node->n_properties = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node->inline_properties)
|
||||||
|
{
|
||||||
|
/* This destroys the list, not just the head of the list */
|
||||||
|
cr_declaration_destroy (node->inline_properties);
|
||||||
|
node->inline_properties = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_custom_stylesheets_changed (StTheme *theme,
|
on_custom_stylesheets_changed (StTheme *theme,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
StThemeNode *node = data;
|
StThemeNode *node = data;
|
||||||
|
maybe_free_properties (node);
|
||||||
node->properties_computed = FALSE;
|
node->properties_computed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,18 +138,7 @@ st_theme_node_finalize (GObject *object)
|
|||||||
g_strfreev (node->pseudo_classes);
|
g_strfreev (node->pseudo_classes);
|
||||||
g_free (node->inline_style);
|
g_free (node->inline_style);
|
||||||
|
|
||||||
if (node->properties)
|
maybe_free_properties (node);
|
||||||
{
|
|
||||||
g_free (node->properties);
|
|
||||||
node->properties = NULL;
|
|
||||||
node->n_properties = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node->inline_properties)
|
|
||||||
{
|
|
||||||
/* This destroys the list, not just the head of the list */
|
|
||||||
cr_declaration_destroy (node->inline_properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node->font_desc)
|
if (node->font_desc)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user