[gtk+] widget path: No need for atomic refcounting



commit 2a6a841db1d318a8632bccafe0e45ce7979e60f6
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 11 19:05:19 2015 -0400

    widget path: No need for atomic refcounting
    
    We are all in one thread, anyway.

 gtk/gtkwidgetpath.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwidgetpath.c b/gtk/gtkwidgetpath.c
index a8504c0..092ae6d 100644
--- a/gtk/gtkwidgetpath.c
+++ b/gtk/gtkwidgetpath.c
@@ -97,7 +97,7 @@ struct GtkPathElement
 
 struct _GtkWidgetPath
 {
-  volatile guint ref_count;
+  guint ref_count;
 
   GArray *elems; /* First element contains the described widget */
 };
@@ -185,7 +185,7 @@ gtk_widget_path_ref (GtkWidgetPath *path)
 {
   gtk_internal_return_val_if_fail (path != NULL, path);
 
-  g_atomic_int_add (&path->ref_count, 1);
+  path->ref_count += 1;
 
   return path;
 }
@@ -206,7 +206,8 @@ gtk_widget_path_unref (GtkWidgetPath *path)
 
   gtk_internal_return_if_fail (path != NULL);
 
-  if (!g_atomic_int_dec_and_test (&path->ref_count))
+  path->ref_count -= 1;
+  if (path->ref_count > 0)
     return;
 
   for (i = 0; i < path->elems->len; i++)


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