Merge branch 'atomic-ref-count' into 'master'

gvarianttypeinfo: Consistently use atomics to access ref_count

See merge request GNOME/glib!444
This commit is contained in:
Philip Withnall 2018-11-02 10:29:48 +00:00
commit 8f115b63b1

View File

@ -167,7 +167,7 @@ g_variant_type_info_check (const GVariantTypeInfo *info,
ContainerInfo *container = (ContainerInfo *) info; ContainerInfo *container = (ContainerInfo *) info;
/* extra checks for containers */ /* 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); g_assert (container->type_string != NULL);
} }
else else
@ -834,7 +834,7 @@ g_variant_type_info_ref (GVariantTypeInfo *info)
{ {
ContainerInfo *container = (ContainerInfo *) 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); g_atomic_int_inc (&container->ref_count);
} }