Fix a use of an invalid iterator

This commit is contained in:
2024-06-14 23:25:43 -07:00
parent b34d559c02
commit be3032e2f3

View File

@@ -955,7 +955,10 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
if (engulfLeft && engulfRight) {
insert({next->getKey(), next->keyLen}, {}, /*endRange*/ true, copy);
if (found) {
remove(iter);
move<std::memory_order_relaxed, false>(copy, latestVersion);
// Point to the same entry as iter pointed to, but it's not
// invalidated
remove(copy);
}
} else if (engulfLeft) {
assert(found);