From 1e4af5269fd5d01188e88bd05116ffaf93ff89ad Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Mon, 27 Nov 2023 18:24:36 -0800 Subject: [PATCH] Fix issue causing Godot Android apps / games to freeze on close The issue occurred because during the 'close' event, the logic was trying to terminate the native engine on the UI thread instead of doing on the render thread. --- .../android/java/lib/src/org/godotengine/godot/Godot.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt index 38961bcda802..2278b46f6c38 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt @@ -536,8 +536,11 @@ class Godot(private val context: Context) : SensorEventListener { for (plugin in pluginRegistry.allPlugins) { plugin.onMainDestroy() } - GodotLib.ondestroy() - forceQuit() + + runOnRenderThread { + GodotLib.ondestroy() + forceQuit() + } } /**