From: Xavier Claessens Date: Wed, 8 Jul 2009 15:36:57 +0000 (+0100) Subject: Use atomic operations to manage EmpathyAdiumData refcount X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=aff75bcc97abac0173dfd4cc6f9a959fbd493ae6 Use atomic operations to manage EmpathyAdiumData refcount --- diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 0464a619..f37c9884 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -1026,7 +1026,7 @@ empathy_adium_data_ref (EmpathyAdiumData *data) { g_return_val_if_fail (data != NULL, NULL); - data->ref_count++; + g_atomic_int_inc (&data->ref_count); return data; } @@ -1036,8 +1036,7 @@ empathy_adium_data_unref (EmpathyAdiumData *data) { g_return_if_fail (data != NULL); - data->ref_count--; - if (data->ref_count == 0) { + if (g_atomic_int_dec_and_test (&data->ref_count)) { g_free (data->path); g_free (data->basedir); g_free (data->template_html);