Thread errors should be correctly displayed in the crash report now
This commit is contained in:
parent
3d03b31d00
commit
c8acd763ef
1 changed files with 13 additions and 1 deletions
|
@ -45,6 +45,7 @@ public class SplashProgress
|
||||||
private static volatile boolean pause = false;
|
private static volatile boolean pause = false;
|
||||||
private static volatile boolean done = false;
|
private static volatile boolean done = false;
|
||||||
private static Thread thread;
|
private static Thread thread;
|
||||||
|
private static volatile Throwable threadError;
|
||||||
private static int angle = 0;
|
private static int angle = 0;
|
||||||
private static final Lock lock = new ReentrantLock(true);
|
private static final Lock lock = new ReentrantLock(true);
|
||||||
private static SplashFontRenderer fontRenderer;
|
private static SplashFontRenderer fontRenderer;
|
||||||
|
@ -322,12 +323,20 @@ public class SplashProgress
|
||||||
public void uncaughtException(Thread t, Throwable e)
|
public void uncaughtException(Thread t, Throwable e)
|
||||||
{
|
{
|
||||||
FMLLog.log(Level.ERROR, e, "Splash thread Exception");
|
FMLLog.log(Level.ERROR, e, "Splash thread Exception");
|
||||||
Minecraft.getMinecraft().crashed(CrashReport.makeCrashReport(e, "Splash thread"));
|
threadError = e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
thread.start();
|
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.
|
* Call before you need to explicitly modify GL context state during loading.
|
||||||
* Resource loading doesn't usually require this call.
|
* Resource loading doesn't usually require this call.
|
||||||
|
@ -338,6 +347,7 @@ public class SplashProgress
|
||||||
public static void pause()
|
public static void pause()
|
||||||
{
|
{
|
||||||
if(!enabled) return;
|
if(!enabled) return;
|
||||||
|
checkThreadState();
|
||||||
pause = true;
|
pause = true;
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try
|
try
|
||||||
|
@ -359,6 +369,7 @@ public class SplashProgress
|
||||||
public static void resume()
|
public static void resume()
|
||||||
{
|
{
|
||||||
if(!enabled) return;
|
if(!enabled) return;
|
||||||
|
checkThreadState();
|
||||||
pause = false;
|
pause = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -376,6 +387,7 @@ public class SplashProgress
|
||||||
public static void finish()
|
public static void finish()
|
||||||
{
|
{
|
||||||
if(!enabled) return;
|
if(!enabled) return;
|
||||||
|
checkThreadState();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
|
|
Loading…
Reference in a new issue