css value: No need for atomic refcounting

We are all in one thread anyway.
This commit is contained in:
Matthias Clasen 2015-09-11 19:04:54 -04:00
parent fe1e2cbfad
commit 9546ce798b
2 changed files with 4 additions and 3 deletions

View File

@ -48,7 +48,7 @@ _gtk_css_value_ref (GtkCssValue *value)
{
gtk_internal_return_val_if_fail (value != NULL, NULL);
g_atomic_int_add (&value->ref_count, 1);
value->ref_count += 1;
return value;
}
@ -59,7 +59,8 @@ _gtk_css_value_unref (GtkCssValue *value)
if (value == NULL)
return;
if (!g_atomic_int_dec_and_test (&value->ref_count))
value->ref_count -= 1;
if (value->ref_count > 0)
return;
value->class->free (value);

View File

@ -35,7 +35,7 @@ typedef struct _GtkCssValueClass GtkCssValueClass;
/* using define instead of struct here so compilers get the packing right */
#define GTK_CSS_VALUE_BASE \
const GtkCssValueClass *class; \
volatile gint ref_count;
gint ref_count;
struct _GtkCssValueClass {
void (* free) (GtkCssValue *value);