[glib: 1/2] gvarianttypeinfo: Consistently use atomics to access ref_count



commit 03518e576e38c63eba231f954ee324538615f12f
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Thu Nov 1 00:00:00 2018 +0000

    gvarianttypeinfo: Consistently use atomics to access ref_count

 glib/gvarianttypeinfo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/glib/gvarianttypeinfo.c b/glib/gvarianttypeinfo.c
index 78d029425..399b610c8 100644
--- a/glib/gvarianttypeinfo.c
+++ b/glib/gvarianttypeinfo.c
@@ -167,7 +167,7 @@ g_variant_type_info_check (const GVariantTypeInfo *info,
       ContainerInfo *container = (ContainerInfo *) info;
 
       /* extra checks for containers */
-      g_assert_cmpint (container->ref_count, >, 0);
+      g_assert_cmpint (g_atomic_int_get (&container->ref_count), >, 0);
       g_assert (container->type_string != NULL);
     }
   else
@@ -834,7 +834,7 @@ g_variant_type_info_ref (GVariantTypeInfo *info)
     {
       ContainerInfo *container = (ContainerInfo *) info;
 
-      g_assert_cmpint (container->ref_count, >, 0);
+      g_assert_cmpint (g_atomic_int_get (&container->ref_count), >, 0);
       g_atomic_int_inc (&container->ref_count);
     }
 


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