diff --git a/VersionedMap.cpp b/VersionedMap.cpp index 8303749..19c8707 100644 --- a/VersionedMap.cpp +++ b/VersionedMap.cpp @@ -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(copy, latestVersion); + // Point to the same entry as iter pointed to, but it's not + // invalidated + remove(copy); } } else if (engulfLeft) { assert(found);