From c8acd763ef231ba28966b3ce2baaad608d2b619f Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 25 Apr 2015 01:27:57 +0300 Subject: [PATCH] Thread errors should be correctly displayed in the crash report now --- .../java/cpw/mods/fml/client/SplashProgress.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/fml/src/main/java/cpw/mods/fml/client/SplashProgress.java b/fml/src/main/java/cpw/mods/fml/client/SplashProgress.java index 3422b9af1e..8fb37457e1 100644 --- a/fml/src/main/java/cpw/mods/fml/client/SplashProgress.java +++ b/fml/src/main/java/cpw/mods/fml/client/SplashProgress.java @@ -45,6 +45,7 @@ public class SplashProgress private static volatile boolean pause = false; private static volatile boolean done = false; private static Thread thread; + private static volatile Throwable threadError; private static int angle = 0; private static final Lock lock = new ReentrantLock(true); private static SplashFontRenderer fontRenderer; @@ -322,12 +323,20 @@ public class SplashProgress public void uncaughtException(Thread t, Throwable e) { FMLLog.log(Level.ERROR, e, "Splash thread Exception"); - Minecraft.getMinecraft().crashed(CrashReport.makeCrashReport(e, "Splash thread")); + threadError = e; } }); thread.start(); + checkThreadState(); } + private static void checkThreadState() + { + if(thread.getState() == Thread.State.TERMINATED || threadError != null) + { + throw new IllegalStateException("Splash thread", threadError); + } + } /** * Call before you need to explicitly modify GL context state during loading. * Resource loading doesn't usually require this call. @@ -338,6 +347,7 @@ public class SplashProgress public static void pause() { if(!enabled) return; + checkThreadState(); pause = true; lock.lock(); try @@ -359,6 +369,7 @@ public class SplashProgress public static void resume() { if(!enabled) return; + checkThreadState(); pause = false; try { @@ -376,6 +387,7 @@ public class SplashProgress public static void finish() { if(!enabled) return; + checkThreadState(); try { done = true;