瀏覽代碼

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.
Fredia Huya-Kouadio 1 年之前
父節點
當前提交
1e4af5269f
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      platform/android/java/lib/src/org/godotengine/godot/Godot.kt

+ 5 - 2
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()
+		}
 	}
 
 	/**