diff --git a/core/src/processing/opengl/PSurfaceJOGL.java b/core/src/processing/opengl/PSurfaceJOGL.java index 7e5e15b66..d7f871f25 100644 --- a/core/src/processing/opengl/PSurfaceJOGL.java +++ b/core/src/processing/opengl/PSurfaceJOGL.java @@ -58,6 +58,7 @@ import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.GLException; import com.jogamp.opengl.GLProfile; import com.jogamp.nativewindow.MutableGraphicsConfiguration; +import com.jogamp.nativewindow.WindowClosingProtocol; import com.jogamp.newt.Display; import com.jogamp.newt.Display.PointerIcon; import com.jogamp.newt.MonitorDevice; @@ -68,6 +69,7 @@ import com.jogamp.newt.event.InputEvent; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.FPSAnimator; + import processing.core.PApplet; import processing.core.PConstants; import processing.core.PGraphics; @@ -314,6 +316,12 @@ public class PSurfaceJOGL implements PSurface { protected void initWindow() { window = GLWindow.create(screen, pgl.getCaps()); + // Make sure that we pass the window close through to exit(), otherwise + // we're likely to have OpenGL try to shut down halfway through rendering + // a frame. Particularly problematic for complex/slow apps. + // https://github.com/processing/processing/issues/4690 + window.setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode.DO_NOTHING_ON_CLOSE); + // if (displayDevice == null) { // // @@ -955,6 +963,7 @@ public class PSurfaceJOGL implements PSurface { @Override public void windowDestroyed(com.jogamp.newt.event.WindowEvent arg0) { + sketch.exit(); } @Override diff --git a/core/todo.txt b/core/todo.txt index 12e7309f0..1b5bcf99c 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -2,6 +2,8 @@ X fix quoting problem in IntDict.toJSON() X add getRenderer() to SurfaceInfo X https://github.com/processing/processing/issues/4441 +X Exceptions thrown in OpenGL apps when hitting window close box +X https://github.com/processing/processing/issues/4690 X add getRowMap() function _ do we want rows() to not be transient?