From 4686c52394c0221ee3236753ad6be48f18b79365 Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Fri, 18 Sep 2015 14:44:32 -0700 Subject: Fix locking on string init map. Related to: https://android-review.googlesource.com/#/c/171621 Change-Id: Ib6dcf9914f490f1d744c0abe1f520e5b307c7acd --- runtime/safe_map.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/safe_map.h') diff --git a/runtime/safe_map.h b/runtime/safe_map.h index 402c7e9cb5..04549c7889 100644 --- a/runtime/safe_map.h +++ b/runtime/safe_map.h @@ -104,12 +104,13 @@ class SafeMap { // Used to insert a new mapping or overwrite an existing mapping. Note that if the value type // of this container is a pointer, any overwritten pointer will be lost and if this container // was the owner, you have a leak. - void Overwrite(const K& k, const V& v) { + iterator Overwrite(const K& k, const V& v) { std::pair result = map_.insert(std::make_pair(k, v)); if (!result.second) { // Already there - update the value for the existing key result.first->second = v; } + return result.first; } bool Equals(const Self& rhs) const { -- cgit v1.2.3-59-g8ed1b