Fix abort when DeleteWeakGlobalRef in ~FrontendClientCallbackImpl()

This week global ref was newed once bug deleted twice. It triggered an
abort on userdebug build when checkJni is enabled.

Bug: 195591944
Fix: 195591944
Test: atest android.media.tv.tuner.cts
Change-Id: I0b46628a0fc192708201c3c8b536b7ad1a4ea8f1
This commit is contained in:
Hongguang
2021-08-04 16:58:07 -07:00
committed by Hongguang Chen
parent e8e2b078f4
commit 4b473fa352

View File

@@ -1245,7 +1245,8 @@ jobject JTuner::openFrontendByHandle(int feHandle) {
return NULL;
}
sp<FrontendClientCallbackImpl> feClientCb = new FrontendClientCallbackImpl(mObject);
sp<FrontendClientCallbackImpl> feClientCb =
new FrontendClientCallbackImpl(env->NewWeakGlobalRef(mObject));
mFeClient->setCallback(feClientCb);
// TODO: add more fields to frontend
return env->NewObject(