mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-22 15:19:16 +02:00
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:
parent
d1beecf1a3
commit
c9ef461aa1
@ -593,12 +593,12 @@ GClosure*
|
|||||||
g_closure_ref (GClosure *closure)
|
g_closure_ref (GClosure *closure)
|
||||||
{
|
{
|
||||||
guint new_ref_count;
|
guint new_ref_count;
|
||||||
|
|
||||||
g_return_val_if_fail (closure != NULL, NULL);
|
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);
|
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 > 1, NULL);
|
||||||
|
g_return_val_if_fail (new_ref_count < CLOSURE_MAX_REF_COUNT + 1, NULL);
|
||||||
|
|
||||||
return closure;
|
return closure;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user