am ea4cdd44: Merge "Race-condition in SoundPool during release"

* commit 'ea4cdd44541d76adea9b0b185740796d6cf6ac64':
  Race-condition in SoundPool during release
This commit is contained in:
Narayan Kamath
2015-01-05 18:02:32 +00:00
committed by Android Git Automerger

View File

@@ -231,14 +231,14 @@ android_media_SoundPool_SoundPoolImpl_release(JNIEnv *env, jobject thiz)
SoundPool *ap = MusterSoundPool(env, thiz);
if (ap != NULL) {
// release weak reference
// release weak reference and clear callback
jobject weakRef = (jobject) ap->getUserData();
ap->setCallback(NULL, NULL);
if (weakRef != NULL) {
env->DeleteGlobalRef(weakRef);
}
// clear callback and native context
ap->setCallback(NULL, NULL);
// clear native context
env->SetLongField(thiz, fields.mNativeContext, 0);
delete ap;
}