[TSAN] Rework assertions to always access refcount atomically

`-fsanitize=address` complained that the `refcount > 0` assertions
were reading without atomics.  We can fix this by reworking them
to read the previous value.

Closes: #582
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2016-11-17 19:41:57 +00:00
1 parent f0519e541f
commit c1c70bceb7
3 files changed
+11 -14

No files matched your search

+2 -1
View File
@@ -2959,7 +2959,8 @@ ostree_repo_commit_modifier_new (OstreeRepoCommitModifierFlags flags,
OstreeRepoCommitModifier *
ostree_repo_commit_modifier_ref (OstreeRepoCommitModifier *modifier)
{
g_atomic_int_inc (&modifier->refcount);
gint refcount = g_atomic_int_add (&modifier->refcount, 1);
g_assert (refcount > 0);
return modifier;
}