aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-03-14 20:44:03 +0100
committerGitHub <noreply@github.com>2023-03-14 20:44:03 +0100
commitf5ac4a5022cd3768d423fecc1632e2735cf083f5 (patch)
treeb36d14a8c522d9988798279bec0572644a8f3026
parent2f8683df80c88fc86cb8e84026b64a399e446cfb (diff)
parentf142da6423d5812bf9a2fe6bf57cbddcda9d95d7 (diff)
Merge pull request #26443 from vespa-engine/assert-expected-guard-value-earlier-in-enable-ref-counted-internal-subref
Assert expected guard value earlier in enable_ref_counted::internal_s…
-rw-r--r--vespalib/src/vespa/vespalib/util/ref_counted.cpp2
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.