summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2022-06-21 05:01:17 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2022-06-23 20:01:12 +0200
commitbfd77693cedc37713b6f1799a694fd44af9ccfe2 (patch)
treec9d912761dd987a003bf6fd898791a6b0ccec963
parent9c32cfbaaa42a89d4d69d62dccd931cf065c53ee (diff)
downloadglib-bfd77693cedc37713b6f1799a694fd44af9ccfe2.tar.gz
gresource: Use atomic pointer exchange operations to nullify and check
-rw-r--r--gio/gresource.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gio/gresource.c b/gio/gresource.c
index 44d517d12..4ccd33364 100644
--- a/gio/gresource.c
+++ b/gio/gresource.c
@@ -1443,14 +1443,13 @@ g_static_resource_fini (GStaticResource *static_resource)
register_lazy_static_resources_unlocked ();
- resource = g_atomic_pointer_get (&static_resource->resource);
+ resource = g_atomic_pointer_exchange (&static_resource->resource, NULL);
if (resource)
{
/* There should be at least two references to the resource now: one for
* static_resource->resource, and one in the registered_resources list. */
g_assert (g_atomic_int_get (&resource->ref_count) >= 2);
- g_atomic_pointer_set (&static_resource->resource, NULL);
g_resources_unregister_unlocked (resource);
g_resource_unref (resource);
}