From ee855b8d77de3d9486170f900433c5c6b433d32a Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 28 Jun 2023 10:45:36 +0300 Subject: [PATCH] Solved strange concurrency crashes due to players keypress-activating disabled buttons --- core/src/com/unciv/ui/components/input/ActorAttachments.kt | 2 ++ core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/components/input/ActorAttachments.kt b/core/src/com/unciv/ui/components/input/ActorAttachments.kt index bcfc1543d8..261791f49f 100644 --- a/core/src/com/unciv/ui/components/input/ActorAttachments.kt +++ b/core/src/com/unciv/ui/components/input/ActorAttachments.kt @@ -1,6 +1,7 @@ package com.unciv.ui.components.input import com.badlogic.gdx.scenes.scene2d.Actor +import com.badlogic.gdx.scenes.scene2d.Touchable import com.unciv.models.UncivSound internal class ActorAttachments private constructor(actor: Actor) { @@ -37,6 +38,7 @@ internal class ActorAttachments private constructor(actor: Actor) { fun activate(type: ActivationTypes): Boolean { if (!this::activationActions.isInitialized) return false + if (this.actor.touchable != Touchable.enabled) return false return activationActions.activate(type) } diff --git a/core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt index d887111533..d588e2bb00 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt @@ -600,7 +600,7 @@ class WorldScreen( if (originalGameInfo.gameParameters.isOnlineMultiplayer) { try { game.onlineMultiplayer.updateGame(gameInfoClone) - }catch (ex: Exception) { + } catch (ex: Exception) { when (ex) { is MultiplayerAuthException -> { launchOnGLThread {