未验证 提交 3ec12d4c 编写于 作者: J Jason Simmons 提交者: GitHub

Detach from JNI before exiting the GPU thread. (#5231)

The GPU thread calls into Java via JNI in order to update external textures.

Fixes https://github.com/flutter/flutter/issues/17329
上级 9ae10ef7
......@@ -34,11 +34,12 @@ AndroidShellHolder::AndroidShellHolder(
thread_host_ = {thread_label, ThreadHost::Type::UI | ThreadHost::Type::GPU |
ThreadHost::Type::IO};
// Detach from JNI when the UI thread exits.
thread_host_.ui_thread->GetTaskRunner()->PostTask(
[key = thread_destruct_key_]() {
FXL_CHECK(pthread_setspecific(key, reinterpret_cast<void*>(1)) == 0);
});
// Detach from JNI when the UI and GPU threads exit.
auto jni_exit_task([key = thread_destruct_key_]() {
FXL_CHECK(pthread_setspecific(key, reinterpret_cast<void*>(1)) == 0);
});
thread_host_.ui_thread->GetTaskRunner()->PostTask(jni_exit_task);
thread_host_.gpu_thread->GetTaskRunner()->PostTask(jni_exit_task);
fml::WeakPtr<PlatformViewAndroid> weak_platform_view;
Shell::CreateCallback<PlatformView> on_create_platform_view =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册