[empathy] Use atomic operations to manage EmpathyAdiumData refcount



commit aff75bcc97abac0173dfd4cc6f9a959fbd493ae6
Author: Xavier Claessens <xclaesse gmail com>
Date:   Wed Jul 8 16:36:57 2009 +0100

    Use atomic operations to manage EmpathyAdiumData refcount

 libempathy-gtk/empathy-theme-adium.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index 0464a61..f37c988 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]