From d6e09b1356b3fbc4b79ce037cfb476588580eb42 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Sun, 5 Jan 2025 14:49:37 +0200 Subject: [PATCH] Avoid ANRs when loading games --- core/src/com/unciv/UncivGame.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index bf7074f426..b7c59d65f0 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -219,6 +219,7 @@ open class UncivGame(val isConsoleMode: Boolean = false) : Game(), PlatformSpeci screenStack.clear() worldScreen = null // This allows the GC to collect our old WorldScreen, otherwise we keep two WorldScreens in memory. + Gdx.input.inputProcessor = null // Avoid ANRs while loading val newWorldScreen = WorldScreen(newGameInfo, autoPlay, newGameInfo.getPlayerToViewAs(), worldScreenRestoreState) worldScreen = newWorldScreen @@ -231,7 +232,7 @@ open class UncivGame(val isConsoleMode: Boolean = false) : Game(), PlatformSpeci } screenStack.addLast(screenToShow) - setScreen(screenToShow) + setScreen(screenToShow) // Only here do we set the inputProcessor again loadingScreen.dispose() return@withGLContext newWorldScreen