forked from AuroraMiddleware/gtk
css value: No need for atomic refcounting
We are all in one thread anyway.
This commit is contained in:
parent
fe1e2cbfad
commit
9546ce798b
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user