Merge "Race-condition in SoundPool during release"
This commit is contained in:
@@ -231,14 +231,14 @@ android_media_SoundPool_SoundPoolImpl_release(JNIEnv *env, jobject thiz)
|
|||||||
SoundPool *ap = MusterSoundPool(env, thiz);
|
SoundPool *ap = MusterSoundPool(env, thiz);
|
||||||
if (ap != NULL) {
|
if (ap != NULL) {
|
||||||
|
|
||||||
// release weak reference
|
// release weak reference and clear callback
|
||||||
jobject weakRef = (jobject) ap->getUserData();
|
jobject weakRef = (jobject) ap->getUserData();
|
||||||
|
ap->setCallback(NULL, NULL);
|
||||||
if (weakRef != NULL) {
|
if (weakRef != NULL) {
|
||||||
env->DeleteGlobalRef(weakRef);
|
env->DeleteGlobalRef(weakRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear callback and native context
|
// clear native context
|
||||||
ap->setCallback(NULL, NULL);
|
|
||||||
env->SetLongField(thiz, fields.mNativeContext, 0);
|
env->SetLongField(thiz, fields.mNativeContext, 0);
|
||||||
delete ap;
|
delete ap;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user