* Display initialization will not continue if crash is encountered

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9535 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 13 years ago
parent fd9f274049
commit 0ba541ecd1
  1. 15
      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 * Does LWJGL display initialization in the OpenGL thread
*/ */
protected void initInThread(){ protected boolean initInThread(){
try{ try {
if (!JmeSystem.isLowPermissions()){ if (!JmeSystem.isLowPermissions()){
// Enable uncaught exception handler only for current thread // Enable uncaught exception handler only for current thread
Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@ -114,6 +114,7 @@ public abstract class LwjglAbstractDisplay extends LwjglContext implements Runna
printContextInitInfo(); printContextInitInfo();
created.set(true); created.set(true);
super.internalCreate();
} catch (Exception ex){ } catch (Exception ex){
try { try {
if (Display.isCreated()) if (Display.isCreated())
@ -123,10 +124,11 @@ public abstract class LwjglAbstractDisplay extends LwjglContext implements Runna
} }
listener.handleError("Failed to create display", ex); 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(); listener.initialize();
return true;
} }
protected boolean checkGLError(){ protected boolean checkGLError(){
@ -202,7 +204,10 @@ public abstract class LwjglAbstractDisplay extends LwjglContext implements Runna
+ "Must set with JmeContext.setSystemListner()."); + "Must set with JmeContext.setSystemListner().");
logger.log(Level.INFO, "Using LWJGL {0}", Sys.getVersion()); logger.log(Level.INFO, "Using LWJGL {0}", Sys.getVersion());
initInThread(); if (!initInThread()) {
logger.log(Level.SEVERE, "Display initialization failed. Cannot continue.");
return;
}
while (true){ while (true){
if (renderable.get()){ if (renderable.get()){
if (Display.isCloseRequested()) if (Display.isCloseRequested())

Loading…
Cancel
Save