[gtk+] css section: No need for atomic refcounting



commit fe1e2cbfad4448aadc10d2a8650836f5d9195e5f
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 11 19:04:07 2015 -0400

    css section: No need for atomic refcounting
    
    We are all in one thread, anyway.

 gtk/gtkcsssection.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcsssection.c b/gtk/gtkcsssection.c
index 491a6d4..5de9728 100644
--- a/gtk/gtkcsssection.c
+++ b/gtk/gtkcsssection.c
@@ -34,7 +34,7 @@
 
 struct _GtkCssSection
 {
-  volatile gint       ref_count;
+  gint                ref_count;
   GtkCssSectionType   section_type;
   GtkCssSection      *parent;
   GFile              *file;
@@ -115,7 +115,7 @@ gtk_css_section_ref (GtkCssSection *section)
 {
   gtk_internal_return_val_if_fail (section != NULL, NULL);
 
-  g_atomic_int_add (&section->ref_count, 1);
+  section->ref_count += 1;
 
   return section;
 }
@@ -134,7 +134,8 @@ gtk_css_section_unref (GtkCssSection *section)
 {
   gtk_internal_return_if_fail (section != NULL);
 
-  if (!g_atomic_int_dec_and_test (&section->ref_count))
+  section->ref_count -= 1;
+  if (section->ref_count > 0)
     return;
 
   if (section->parent)


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