From 4ce521cdbc2a5885a6027e3efd1c94edf11d895a Mon Sep 17 00:00:00 2001 From: Bixilon Date: Sat, 17 Sep 2022 16:26:36 +0200 Subject: [PATCH] macOS: crash if `-XstartOnFirstThread` is set * This flag is now not needed anymore and even crashes minosoft if set --- src/main/java/de/bixilon/minosoft/Minosoft.kt | 9 +-- .../profile/profiles/other/OtherProfile.kt | 8 --- .../gui/eros/XStartOnFirstThreadWarning.kt | 60 ------------------- .../de/bixilon/minosoft/main/BootTasks.kt | 1 - .../assets/minosoft/language/en_us.lang | 10 ---- .../assets/minosoft/language/es_es.lang | 9 --- 6 files changed, 5 insertions(+), 92 deletions(-) delete mode 100644 src/main/java/de/bixilon/minosoft/gui/eros/XStartOnFirstThreadWarning.kt diff --git a/src/main/java/de/bixilon/minosoft/Minosoft.kt b/src/main/java/de/bixilon/minosoft/Minosoft.kt index b884fad86..a4d118855 100644 --- a/src/main/java/de/bixilon/minosoft/Minosoft.kt +++ b/src/main/java/de/bixilon/minosoft/Minosoft.kt @@ -22,6 +22,8 @@ import de.bixilon.kutil.latch.CountUpAndDownLatch import de.bixilon.kutil.os.OSTypes import de.bixilon.kutil.os.PlatformInfo import de.bixilon.kutil.reflection.ReflectionUtil.forceInit +import de.bixilon.kutil.shutdown.AbstractShutdownReason +import de.bixilon.kutil.shutdown.ShutdownManager import de.bixilon.minosoft.assets.file.ResourcesAssetsUtil import de.bixilon.minosoft.assets.properties.version.AssetsVersionProperties import de.bixilon.minosoft.config.profile.GlobalProfileManager @@ -33,7 +35,6 @@ import de.bixilon.minosoft.data.registries.DefaultRegistries import de.bixilon.minosoft.data.registries.ResourceLocation import de.bixilon.minosoft.data.registries.versions.Versions import de.bixilon.minosoft.gui.eros.Eros -import de.bixilon.minosoft.gui.eros.XStartOnFirstThreadWarning import de.bixilon.minosoft.gui.eros.crash.ErosCrashReport.Companion.crash import de.bixilon.minosoft.gui.eros.dialog.StartingDialog import de.bixilon.minosoft.gui.eros.util.JavaFXInitializer @@ -94,7 +95,6 @@ object Minosoft { if (!RunConfiguration.DISABLE_EROS) { taskWorker += Task(identifier = BootTasks.JAVAFX, executor = { JavaFXInitializer.start() }) DefaultThreadPool += { javafx.scene.text.Font::class.java.forceInit() } - taskWorker += Task(identifier = BootTasks.X_START_ON_FIRST_THREAD_WARNING, executor = { XStartOnFirstThreadWarning.show() }, dependencies = arrayOf(BootTasks.LANGUAGE_FILES, BootTasks.JAVAFX)) taskWorker += Task(identifier = BootTasks.STARTUP_PROGRESS, executor = { StartingDialog(BOOT_LATCH).show() }, dependencies = arrayOf(BootTasks.LANGUAGE_FILES, BootTasks.JAVAFX)) @@ -134,8 +134,9 @@ object Minosoft { } private fun warnMacOS() { - if (PlatformInfo.OS == OSTypes.MAC && !RunConfiguration.X_START_ON_FIRST_THREAD_SET && !RunConfiguration.DISABLE_RENDERING) { - Log.log(LogMessageType.GENERAL, LogLevels.WARN) { "You are using MacOS. To use rendering you have to add the jvm argument §9-XstartOnFirstThread§r. Please ensure it is set!" } + if (PlatformInfo.OS == OSTypes.MAC && RunConfiguration.X_START_ON_FIRST_THREAD_SET && (!RunConfiguration.DISABLE_RENDERING || !RunConfiguration.DISABLE_EROS)) { + Log.log(LogMessageType.GENERAL, LogLevels.WARN) { "You are using MacOS. To use rendering you must not set the jvm argument §9-XstartOnFirstThread§r. Please remove it!" } + ShutdownManager.shutdown(reason = AbstractShutdownReason.CRASH) } } } diff --git a/src/main/java/de/bixilon/minosoft/config/profile/profiles/other/OtherProfile.kt b/src/main/java/de/bixilon/minosoft/config/profile/profiles/other/OtherProfile.kt index 82f6971b5..7cee2fee1 100644 --- a/src/main/java/de/bixilon/minosoft/config/profile/profiles/other/OtherProfile.kt +++ b/src/main/java/de/bixilon/minosoft/config/profile/profiles/other/OtherProfile.kt @@ -40,14 +40,6 @@ class OtherProfile( */ var nativeNetwork by delegate(true) - - /** - * MacOS only: Ignores the warning if the jvm argument - * -XStartOnFirstThread is not set. - * See [#29](https://gitlab.bixilon.de/bixilon/minosoft/-/issues/29) for more details - */ - var ignoreXStartOnFirstThreadWarning by delegate(false) - /** * Listens for servers on your LAN network */ diff --git a/src/main/java/de/bixilon/minosoft/gui/eros/XStartOnFirstThreadWarning.kt b/src/main/java/de/bixilon/minosoft/gui/eros/XStartOnFirstThreadWarning.kt deleted file mode 100644 index 6eefce537..000000000 --- a/src/main/java/de/bixilon/minosoft/gui/eros/XStartOnFirstThreadWarning.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2022 Moritz Zwerger - * - * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program. If not, see . - * - * This software is not affiliated with Mojang AB, the original developer of Minecraft. - */ - -package de.bixilon.minosoft.gui.eros - -import de.bixilon.kutil.os.OSTypes -import de.bixilon.kutil.os.PlatformInfo -import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager -import de.bixilon.minosoft.gui.eros.dialog.SimpleErosWarningDialog -import de.bixilon.minosoft.terminal.RunConfiguration -import de.bixilon.minosoft.util.KUtil.toResourceLocation -import javafx.stage.Modality - -object XStartOnFirstThreadWarning { - - private fun showJavaFXRunningWarning() { - val dialog = SimpleErosWarningDialog( - title = "minosoft:x_start_on_first_thread_warning.eros_running.title".toResourceLocation(), - header = "minosoft:x_start_on_first_thread_warning.eros_running.header".toResourceLocation(), - description = "minosoft:x_start_on_first_thread_warning.eros_running.description".toResourceLocation(), - onIgnore = { Eros.start() }, - modality = Modality.APPLICATION_MODAL, - ) - dialog.show() - Eros.skipErosStartup = true - } - - @Synchronized - fun show() { - if (PlatformInfo.OS != OSTypes.MAC || RunConfiguration.DISABLE_RENDERING) { - return - } - if (OtherProfileManager.selected.ignoreXStartOnFirstThreadWarning) { - return - } - if (RunConfiguration.X_START_ON_FIRST_THREAD_SET) { - return showJavaFXRunningWarning() - } - - val dialog = SimpleErosWarningDialog( - title = "minosoft:x_start_on_first_thread_warning.title".toResourceLocation(), - header = "minosoft:x_start_on_first_thread_warning.header".toResourceLocation(), - description = "minosoft:x_start_on_first_thread_warning.description".toResourceLocation(), - onIgnore = { Eros.start() }, - modality = Modality.APPLICATION_MODAL, - ) - dialog.show() - Eros.skipErosStartup = true - } -} diff --git a/src/main/java/de/bixilon/minosoft/main/BootTasks.kt b/src/main/java/de/bixilon/minosoft/main/BootTasks.kt index 6dade0381..e1c86c5e1 100644 --- a/src/main/java/de/bixilon/minosoft/main/BootTasks.kt +++ b/src/main/java/de/bixilon/minosoft/main/BootTasks.kt @@ -22,7 +22,6 @@ enum class BootTasks { DEFAULT_REGISTRIES, LAN_SERVERS, JAVAFX, - X_START_ON_FIRST_THREAD_WARNING, FILE_WATCHER, YGGDRASIL, STARTUP_PROGRESS, diff --git a/src/main/resources/assets/minosoft/language/en_us.lang b/src/main/resources/assets/minosoft/language/en_us.lang index b00ef8de5..497913c41 100644 --- a/src/main/resources/assets/minosoft/language/en_us.lang +++ b/src/main/resources/assets/minosoft/language/en_us.lang @@ -151,16 +151,6 @@ minosoft:error.header=An error occurred! minosoft:error.description=An error in minosoft occurred. You can continue like before, but the behavior might not be the expected one. If this error persists, feel free to open an issue here: https://gitlab.bixilon.de/bixilon/minosoft/-/issues/ minosoft:error.fatal_crash=Fatal crash - -minosoft:x_start_on_first_thread_warning.title=-XstartOnFirstThread not set -minosoft:x_start_on_first_thread_warning.header=-XstartOnFirstThread is not set -minosoft:x_start_on_first_thread_warning.description=It looks like you are using MacOS. Due to some design decisions made by apple, you have to set §7-XstartOnFirstThread§r as JVM Argument if you plan to use rendering. If you don't know how or just think this is shit, take a look at https://gitlab.bixilon.de/bixilon/minosoft/-/issues/29 - -minosoft:x_start_on_first_thread_warning.eros_running.title=Eros is running -minosoft:x_start_on_first_thread_warning.eros_running.header=Eros is running -minosoft:x_start_on_first_thread_warning.eros_running.description=It looks like eros is running and you plan to use rendering. This is (on MacOS) currently not possible. You have to set §7-XstartOnFirstThread §ras jvm argument and use the §7auto-connect §rcommand line option to connect to a server. Sorry for this. If you don't know how or just think that this is shit. take a look at https://gitlab.bixilon.de/bixilon/minosoft/-/issues/29 - - minosoft:general.dialog.profile.select.title=Select profiles minosoft:general.dialog.profile.select.header=Select profiles diff --git a/src/main/resources/assets/minosoft/language/es_es.lang b/src/main/resources/assets/minosoft/language/es_es.lang index fd8006f03..9ec9fd8ca 100644 --- a/src/main/resources/assets/minosoft/language/es_es.lang +++ b/src/main/resources/assets/minosoft/language/es_es.lang @@ -111,15 +111,6 @@ minosoft:error.description=Ha ocurrido un error en Minosoft. Puedes continuar co minosoft:error.fatal_crash=Cierre inesperado -minosoft:x_start_on_first_thread_warning.title=-XstartOnFirstThread no especificado -minosoft:x_start_on_first_thread_warning.header=-XstartOnFirstThread no especificado -minosoft:x_start_on_first_thread_warning.description=Parece que estas en MacOS; Debido a unas decisiones hechas por Apple, tendras que poner §7-XstartOnFirstThread§r como un argumento de Java si deseas usar el renderizado. Si no sabes como o no te gusta este comportamiento echa un vistazo a https://gitlab.bixilon.de/bixilon/minosoft/-/issues/29 - -minosoft:x_start_on_first_thread_warning.eros_running.title=Eros ejecutandose -minosoft:x_start_on_first_thread_warning.eros_running.header=Eros ejecutandose -minosoft:x_start_on_first_thread_warning.eros_running.description=Parece que Eros se esta ejecutando y planeas usar el renderizado. Esto (en MacOS) no es posible actualmente. Tienes que añadir §7-XstartOnFirstThread §rcomo un argumento de Java y el comando §7auto-connect §rpara conectarte a un servidor. Lo sentimos por esto. Si no te gusta este comportamiento echa un vistazo a https://gitlab.bixilon.de/bixilon/minosoft/-/issues/29 - - minosoft:general.dialog.profile.select.title=Seleccionar perfiles minosoft:general.dialog.profile.select.header=Seleccionar perfiles