From 0f0b3bee2157be6ad0c2ef9bbac39a9cae29e85c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 8 Jun 2023 11:13:33 -0600 Subject: [PATCH] [map] Fix use-after-move issue --- src/hb-map.hh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hb-map.hh b/src/hb-map.hh index e89c3e9eb..2ddb45565 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -258,7 +258,11 @@ struct hb_hashmap_t template bool set (const K &key, VV&& value, bool overwrite = true) { return set_with_hash (key, hb_hash (key), std::forward (value), overwrite); } template - bool set (K &&key, VV&& value, bool overwrite = true) { return set_with_hash (std::move (key), hb_hash (key), std::forward (value), overwrite); } + bool set (K &&key, VV&& value, bool overwrite = true) + { + uint32_t hash = hb_hash (key); + return set_with_hash (std::move (key), hash, std::forward (value), overwrite); + } const V& get_with_hash (const K &key, uint32_t hash) const {