From c65b1fee8d01fdfd092933dff635a78feda1140f Mon Sep 17 00:00:00 2001 From: Max Kellermann <mk@cm4all.com> Date: Thu, 1 Dec 2022 18:52:52 +0100 Subject: [PATCH] util/IntrusiveHashSet: check key equivalence in remove_and_dispose_if() --- src/util/IntrusiveHashSet.hxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/IntrusiveHashSet.hxx b/src/util/IntrusiveHashSet.hxx index b6567e12d..a5bf5926d 100644 --- a/src/util/IntrusiveHashSet.hxx +++ b/src/util/IntrusiveHashSet.hxx @@ -214,7 +214,9 @@ public: static_assert(!constant_time_size, "Not yet implemented"); auto &bucket = GetBucket(key); - bucket.remove_and_dispose_if(pred, disposer); + bucket.remove_and_dispose_if([this, &key, &pred](const auto &item){ + return equal(key, item) && pred(item); + }, disposer); } [[nodiscard]]