Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea4cdd44 authored by Narayan Kamath's avatar Narayan Kamath Committed by Gerrit Code Review
Browse files

Merge "Race-condition in SoundPool during release"

parents 873b291b ed86e19a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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;
    }