Skip to content

fix(base): UnorderedMap inserts no longer duplicate a key past a tombstone - #23

Merged
Force67 merged 1 commit into
devel5from
fix/unordered-map-tombstone-dup
Sep 27, 2026
Merged

Force67 merged 1 commit into
devel5from
fix/unordered-map-tombstone-dup

Conversation

@Force67

@Force67 Force67 commented Sep 27, 2026

Copy link
Copy Markdown
Owner

operator[], insert and emplace claimed the first tombstone on the probe chain without checking whether the key sat further along it. After an erase, re-inserting a colliding key stored it twice; size() grew and a later erase left the stale copy findable.

The insert paths now share one probe that runs to an empty slot and only then reuses the first tombstone. Reusing a tombstone also decrements tombstone_count_, which was never done, so the map rehashed early.

UnorderedSet wraps UnorderedMap and is fixed with it. Three regression tests fail before and pass after.

@Force67
Force67 merged commit b24fd8b into devel5 Sep 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant