Commit b302785d authored by Jacob Potter's avatar Jacob Potter

Eagerly remove expired WeakReferences from the map

parent b0a4bf54
...@@ -534,6 +534,9 @@ struct CppProxyCacheState { ...@@ -534,6 +534,9 @@ struct CppProxyCacheState {
// It's in the map. See if the WeakReference still points to an object. // It's in the map. See if the WeakReference still points to an object.
if (jobject javaObj = it->second.get(jniEnv)) { if (jobject javaObj = it->second.get(jniEnv)) {
return javaObj; return javaObj;
} else {
// The WeakReference is expired, so prune it from the map eagerly.
st.m.erase(it);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment