Correctly track exceptions thrown in the loading screen rendering thread

This commit is contained in:
RainWarrior committed 2015-04-24 05:38:32 +03:00
1 parent 87e6c29028
commit 53a21e7e47
1 file changed
+12
@@ -2,6 +2,7 @@ package cpw.mods.fml.client;
import java.io.IOException;
import java.io.InputStream;
import java.lang.Thread.UncaughtExceptionHandler;
import java.util.Iterator;
import java.util.Properties;
import java.util.concurrent.locks.Lock;
@@ -20,6 +21,7 @@ import net.minecraft.crash.CrashReport;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.Level;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.Drawable;
@@ -27,6 +29,7 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.SharedDrawable;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.ICrashCallable;
import cpw.mods.fml.common.ProgressManager;
import cpw.mods.fml.common.ProgressManager.ProgressBar;
@@ -105,6 +108,7 @@ public class SplashProgress
e.printStackTrace();
throw new RuntimeException(e);
}
Thread mainThread = Thread.currentThread();
thread = new Thread(new Runnable()
{
private final int barWidth = 400;
@@ -313,6 +317,14 @@ public class SplashProgress
}
}
});
thread.setUncaughtExceptionHandler(new UncaughtExceptionHandler()
{
public void uncaughtException(Thread t, Throwable e)
{
FMLLog.log(Level.ERROR, e, "Splash thread Exception");
Minecraft.getMinecraft().crashed(CrashReport.makeCrashReport(e, "Splash thread"));
}
});
thread.start();
}