diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-03-14 18:41:40 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-03-14 18:41:40 +0100 |
commit | f142da6423d5812bf9a2fe6bf57cbddcda9d95d7 (patch) | |
tree | b36d14a8c522d9988798279bec0572644a8f3026 | |
parent | 2f8683df80c88fc86cb8e84026b64a399e446cfb (diff) |
Assert expected guard value earlier in enable_ref_counted::internal_subref
-rw-r--r-- | vespalib/src/vespa/vespalib/util/ref_counted.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/util/ref_counted.cpp b/vespalib/src/vespa/vespalib/util/ref_counted.cpp index b3ff5e9f43a..6dc0a540867 100644 --- a/vespalib/src/vespa/vespalib/util/ref_counted.cpp +++ b/vespalib/src/vespa/vespalib/util/ref_counted.cpp @@ -18,6 +18,7 @@ enable_ref_counted::internal_addref(uint32_t cnt) const noexcept void enable_ref_counted::internal_subref(uint32_t cnt, [[maybe_unused]] uint32_t reserve) const noexcept { + assert(_guard == MAGIC); // release because: // our changes to the object must be visible to the deleter // @@ -25,7 +26,6 @@ enable_ref_counted::internal_subref(uint32_t cnt, [[maybe_unused]] uint32_t rese // we need to see all object changes before deleting it auto prev = _refs.fetch_sub(cnt, std::memory_order_acq_rel); assert(prev >= (reserve + cnt)); - assert(_guard == MAGIC); if (prev == cnt) { // not using conditional atomic thread fence since thread // sanitizer does not support it. |