From fb13f1936329dd070e9e2b62729e7e04f7b640af Mon Sep 17 00:00:00 2001 From: Pickle Burger Date: Thu, 9 May 2024 16:48:30 -0700 Subject: [PATCH] let Jvm live longer --- rust/src/async_api/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust/src/async_api/mod.rs b/rust/src/async_api/mod.rs index 580d2ba..d49c231 100644 --- a/rust/src/async_api/mod.rs +++ b/rust/src/async_api/mod.rs @@ -69,7 +69,8 @@ impl Jvm { // Create and return the Instance let instance = rx.await?; - let new_jni_env = Jvm::attach_thread()?.jni_env; + let new_jvm = Jvm::attach_thread()?; + let new_jni_env = new_jvm.jni_env; Self::do_return(new_jni_env, instance)? }