From 25a8836b6493d1873d7c263bb5603c2a4e3364a1 Mon Sep 17 00:00:00 2001 From: Baiker000 Date: Mon, 15 Jan 2024 07:16:32 +0200 Subject: [PATCH] Add release_android_context on destroy (#860) --- .changes/android-context-release.md | 5 +++++ src/platform_impl/android/ndk_glue.rs | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changes/android-context-release.md diff --git a/.changes/android-context-release.md b/.changes/android-context-release.md new file mode 100644 index 000000000..f9cd01ad4 --- /dev/null +++ b/.changes/android-context-release.md @@ -0,0 +1,5 @@ +--- +"tao": patch +--- + +Fix the app crash on restart due to Android context was not released. Release the Android context when the app is destroyed to avoid assertion failure. \ No newline at end of file diff --git a/src/platform_impl/android/ndk_glue.rs b/src/platform_impl/android/ndk_glue.rs index 2d5b03b6b..cb7678339 100644 --- a/src/platform_impl/android/ndk_glue.rs +++ b/src/platform_impl/android/ndk_glue.rs @@ -297,6 +297,7 @@ pub unsafe fn save(_: JNIEnv, _: JClass, _: JObject) { pub unsafe fn destroy(_: JNIEnv, _: JClass, _: JObject) { wake(Event::Destroy); + ndk_context::release_android_context(); } pub unsafe fn memory(_: JNIEnv, _: JClass, _: JObject) {