From f41cbf10d04f18664447b9a354f1b20f29c77aec Mon Sep 17 00:00:00 2001 From: cobalt-github-releaser-bot <95661244+cobalt-github-releaser-bot@users.noreply.github.com> Date: Tue, 7 May 2024 12:25:07 -0700 Subject: [PATCH] Cherry pick PR #3176: Fix JNI cleanup on ATV for posix threads. (#3180) Refer to the original PR: https://github.com/youtube/cobalt/pull/3176 b/339018103 Change-Id: I45d941655a03824591af47ba70bc2be78b8bb95e Co-authored-by: Yavor Goulishev --- starboard/android/shared/jni_env_ext.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/starboard/android/shared/jni_env_ext.cc b/starboard/android/shared/jni_env_ext.cc index 9d6361d5d356..7ba6c687d660 100644 --- a/starboard/android/shared/jni_env_ext.cc +++ b/starboard/android/shared/jni_env_ext.cc @@ -30,8 +30,9 @@ jobject g_application_class_loader = NULL; jobject g_starboard_bridge = NULL; void Destroy(void* value) { - // OnThreadShutdown() must be called on each thread before it is destroyed. - SB_DCHECK(value == NULL); + if (value != NULL) { + starboard::android::shared::JniEnvExt::OnThreadShutdown(); + } } } // namespace