From ee5c34e5bb067631572a7001ab1ec3543c52065f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 17 Aug 2012 13:47:48 +0200 Subject: Robostness: GLDrawableImpl's contextMadeCurrent()/contextRealized() ; GLFBODrawableImpl.contextMadeCurrent(false), OffscreenAutoDrawable.setSize(..) GLDrawableImpl's contextMadeCurrent()/contextRealized(): - Catch exception which may appear during callback and cont. w/ GLContextImpl's release()/destroy() while throwing catched exception at end. GLFBODrawableImpl.contextMadeCurrent(false): - Detect null Colorbuffer ASAP and throw exception OffscreenAutoDrawable.setSize(..): - Catch exceptions at 1) GLFBODrawableImpl.setSize(..) and 2) GLContext.release() .. throw it in proper order. --- .../classes/com/jogamp/opengl/OffscreenAutoDrawable.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/com/jogamp') diff --git a/src/jogl/classes/com/jogamp/opengl/OffscreenAutoDrawable.java b/src/jogl/classes/com/jogamp/opengl/OffscreenAutoDrawable.java index 8450ffdb0..4caea03b2 100644 --- a/src/jogl/classes/com/jogamp/opengl/OffscreenAutoDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/OffscreenAutoDrawable.java @@ -69,12 +69,26 @@ public class OffscreenAutoDrawable extends GLAutoDrawableDelegate { public boolean setSize(int newWidth, int newHeight) throws GLException { boolean done = false; if(drawable instanceof GLFBODrawableImpl) { + Throwable tFBO = null; + Throwable tGL = null; context.makeCurrent(); try { ((GLFBODrawableImpl)drawable).setSize(context.getGL(), newWidth, newHeight); done = true; + } catch (Throwable t) { + tFBO = t; } finally { - context.release(); + try { + context.release(); + } catch (Throwable t) { + tGL = t; + } + } + if(null != tFBO) { + throw new GLException("OffscreenAutoDrawable.setSize(..) GLFBODrawableImpl.setSize(..) exception", tFBO); + } + if(null != tGL) { + throw new GLException("OffscreenAutoDrawable.setSize(..) GLContext.release() exception", tGL); } } if(done) { -- cgit v1.2.3