forked from firka/flutter
Detach from JNI before exiting the GPU thread. (flutter/engine#5231)
The GPU thread calls into Java via JNI in order to update external textures. Fixes https://github.com/flutter/flutter/issues/17329
This commit is contained in:
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user