macOS: crash if -XstartOnFirstThread is set

* This flag is now not needed anymore and even crashes minosoft if set
This commit is contained in:
Bixilon 2022-09-17 16:26:36 +02:00
parent 77361abdc4
commit 4ce521cdbc
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
6 changed files with 5 additions and 92 deletions

View File

@ -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)
}
}
}

View File

@ -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
*/

View File

@ -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 <https://www.gnu.org/licenses/>.
*
* 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
}
}

View File

@ -22,7 +22,6 @@ enum class BootTasks {
DEFAULT_REGISTRIES,
LAN_SERVERS,
JAVAFX,
X_START_ON_FIRST_THREAD_WARNING,
FILE_WATCHER,
YGGDRASIL,
STARTUP_PROGRESS,

View File

@ -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

View File

@ -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