diff --git a/forge-gui-mobile-dev/src/forge/app/Main.java b/forge-gui-mobile-dev/src/forge/app/Main.java index 8714712af23..2ebf437ce40 100644 --- a/forge-gui-mobile-dev/src/forge/app/Main.java +++ b/forge-gui-mobile-dev/src/forge/app/Main.java @@ -20,9 +20,21 @@ public class Main { private static final String versionString = BuildInfo.getVersionString(); public static void main(String[] args) { + if (!OperatingSystem.isWindows()) { + /* Prevents crash on non Windows OS before creating the LWJGL3 window. + It seems it defeats the purpose of having a splash image since + this is an indicator if the LWJGL3 has booted up succesfully. */ + closeSplash(); + } new GameLauncher(versionString); } - + public static void closeSplash() { + try { + Optional.ofNullable(SplashScreen.getSplashScreen()).ifPresent(SplashScreen::close); + } catch (Exception e) { + e.printStackTrace(); + } + } public static class DesktopAdapter implements IDeviceAdapter { private final String switchOrientationFile; @@ -96,15 +108,7 @@ public void exit() { @Override public void closeSplashScreen() { - // FIXME: on Linux system it can't close splashscreen image or crash with SIGSEGV? How come it works on other OS? - if (OperatingSystem.isUnix() || OperatingSystem.isSolaris()) - return; - //could throw exception.. - try { - Optional.ofNullable(SplashScreen.getSplashScreen()).ifPresent(SplashScreen::close); - } catch (Exception e) { - e.printStackTrace(); - } + closeSplash(); } @Override diff --git a/forge-gui-mobile/src/forge/Forge.java b/forge-gui-mobile/src/forge/Forge.java index 7dafac0f1e7..8d03bdc24f2 100644 --- a/forge-gui-mobile/src/forge/Forge.java +++ b/forge-gui-mobile/src/forge/Forge.java @@ -159,7 +159,9 @@ public static Localizer getLocalizer() { public void create() { //install our error handler ExceptionHandler.registerErrorHandling(); - getDeviceAdapter().closeSplashScreen(); + // closeSplashScreen() is called early on non-Windows OS so it will not crash, LWJGL3 bug on AWT Splash. + if (OperatingSystem.isWindows()) + getDeviceAdapter().closeSplashScreen(); GuiBase.setIsAndroid(Gdx.app.getType() == Application.ApplicationType.Android);