gclosure: Ensure all reads of GClosure.ref_count are atomic

Remove the last few non-atomic reads of `GClosure.ref_count`. See
previous commits for an explanation of why this is important.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2025-04-04 01:03:55 +01:00
parent d1beecf1a3
commit c9ef461aa1
No known key found for this signature in database
GPG Key ID: C5C42CFB268637CA

View File

@ -593,12 +593,12 @@ GClosure*
g_closure_ref (GClosure *closure)
{
guint new_ref_count;
g_return_val_if_fail (closure != NULL, NULL);
g_return_val_if_fail (closure->ref_count > 0, NULL);
g_return_val_if_fail (closure->ref_count < CLOSURE_MAX_REF_COUNT, NULL);
ATOMIC_INC_ASSIGN (closure, ref_count, &new_ref_count);
g_return_val_if_fail (new_ref_count > 1, NULL);
g_return_val_if_fail (new_ref_count < CLOSURE_MAX_REF_COUNT + 1, NULL);
return closure;
}