Commit 97f49c68 authored by Cosimo Cecchi's avatar Cosimo Cecchi

csskeyframes: unref GtkCssValues when free-ing

We assume a reference to all the GtkCssValues we store, so we need to
release it when free-ing.
parent 6fb66261
......@@ -36,6 +36,8 @@ struct _GtkCssKeyframes {
GtkCssValue **values; /* 2D array: n_keyframes * n_properties of (value or NULL) for all the keyframes */
};
#define KEYFRAMES_VALUE(keyframes, k, p) ((keyframes)->values[(k) * (keyframes)->n_properties + (p)])
GtkCssKeyframes *
_gtk_css_keyframes_ref (GtkCssKeyframes *keyframes)
{
......@@ -49,6 +51,8 @@ _gtk_css_keyframes_ref (GtkCssKeyframes *keyframes)
void
_gtk_css_keyframes_unref (GtkCssKeyframes *keyframes)
{
guint k, p;
g_return_if_fail (keyframes != NULL);
keyframes->ref_count--;
......@@ -57,13 +61,20 @@ _gtk_css_keyframes_unref (GtkCssKeyframes *keyframes)
g_free (keyframes->keyframe_progress);
g_free (keyframes->property_ids);
for (k = 0; k < keyframes->n_keyframes; k++)
{
for (p = 0; p < keyframes->n_properties; p++)
{
_gtk_css_value_unref (KEYFRAMES_VALUE (keyframes, k, p));
KEYFRAMES_VALUE (keyframes, k, p) = NULL;
}
}
g_free (keyframes->values);
g_slice_free (GtkCssKeyframes, keyframes);
}
#define KEYFRAMES_VALUE(keyframes, k, p) ((keyframes)->values[(k) * (keyframes)->n_properties + (p)])
static guint
gtk_css_keyframes_add_keyframe (GtkCssKeyframes *keyframes,
double progress)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment