From 0ba541ecd1f7e489aba538c548edfafe21000500 Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sat, 30 Jun 2012 18:07:32 +0000 Subject: [PATCH] * Display initialization will not continue if crash is encountered git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9535 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../jme3/system/lwjgl/LwjglAbstractDisplay.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/engine/src/lwjgl/com/jme3/system/lwjgl/LwjglAbstractDisplay.java b/engine/src/lwjgl/com/jme3/system/lwjgl/LwjglAbstractDisplay.java index b1171cd32..c40019e3f 100644 --- a/engine/src/lwjgl/com/jme3/system/lwjgl/LwjglAbstractDisplay.java +++ b/engine/src/lwjgl/com/jme3/system/lwjgl/LwjglAbstractDisplay.java @@ -90,8 +90,8 @@ public abstract class LwjglAbstractDisplay extends LwjglContext implements Runna /** * Does LWJGL display initialization in the OpenGL thread */ - protected void initInThread(){ - try{ + protected boolean initInThread(){ + try { if (!JmeSystem.isLowPermissions()){ // Enable uncaught exception handler only for current thread Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @@ -114,6 +114,7 @@ public abstract class LwjglAbstractDisplay extends LwjglContext implements Runna printContextInitInfo(); created.set(true); + super.internalCreate(); } catch (Exception ex){ try { if (Display.isCreated()) @@ -123,10 +124,11 @@ public abstract class LwjglAbstractDisplay extends LwjglContext implements Runna } listener.handleError("Failed to create display", ex); - return; // if we failed to create display, do not continue + return false; // if we failed to create display, do not continue } - super.internalCreate(); + listener.initialize(); + return true; } protected boolean checkGLError(){ @@ -202,7 +204,10 @@ public abstract class LwjglAbstractDisplay extends LwjglContext implements Runna + "Must set with JmeContext.setSystemListner()."); logger.log(Level.INFO, "Using LWJGL {0}", Sys.getVersion()); - initInThread(); + if (!initInThread()) { + logger.log(Level.SEVERE, "Display initialization failed. Cannot continue."); + return; + } while (true){ if (renderable.get()){ if (Display.isCloseRequested())