From ba1ffe66697c3175b423cb7ab9b686d73959708d Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Thu, 31 Jul 2014 02:42:39 +0200
Subject: Bug 1039 - Specify behavior of GLEventListener Exceptions occurring
 while GLAutoDrawable processing [part-1]

Implements Specification as described on 'Bug 1039 Comment 1'
  <https://jogamp.org/bugzilla/show_bug.cgi?id=1039#c1>

TODO:
  - Offthread exception handler

++++

GLDrawableHelper is used in all GLAutoDrawable implementations
and for most operations.

GLAutoDrawable/GLDrawableHelper invoke(..) method:

- invoke(..) forwards a caught exception
  - if blocking, it forwards an exception
    happening within the passed GLRunnable(s).
    Here the exception is caught, printed
    and then thrown by invoke itself.

  - if non-blocking, an exception
    happening within the passed GLRunnable(s)
    will be thrown in the thread issuing it's execution,
    i.e. display() call.
    Here the exception is not caught and simply thrown
    by the GLRunnable.

GLAutoDrawable.destroy() -> GLDrawableHelper.disposeGL(..) method:

- disposeAllGLEventListener() being invoked by disposeGL(..),
  catches exception thrown by GLEventListener.dispose(..)
  and prints them to stderr.
  The first caught exception is re-thrown at the end as an GLException.

- disposeGL() catches re-thrown GLException by disposeAllGLEventListener()
  for GLEventListener.dispose(..)
  and re-throws it when operation is complete.

- disposeGL() catches an exception thrown at context destruction or release
  and re-throws it when operation is complete.
  An early exception at context.makeCurrent() is _not_ caught,
  since it is the first operation which simply shall unwind the stack.

GLAutoDrawable.display() -> GLDrawableHelper.invokeGLImpl(..) method:

- invokeGLImpl(..) for display() follows disposeGL() mechanism, i.e.
  it catches exception thrown at
  GLEventListener's init(..), reshape(..) and display(..) methods
  and re-throws it when operation is complete.

  It also catches an exception thrown at context release
  and re-throws it when operation is complete.
  An early exception at context.makeCurrent() is _not_ caught,
  since it is the first operation which simply shall unwind the stack.

++++

None of the above thrown exception shall be caught and suppressed
on the caller side.

If an operation must be completed while an exception is caught,
it shall be cached and re-thrown after the operations.

In case multiple exception at multiple places are caught within
an operation, they all shall be cached and the first one
shall be re-thrown.

In case of multiple exception from the same place,
i.e. a loop through all GLEventListener,
the first shall be cached and re-thrown after operation is completed.

It has to be determined, whether we like to dump the exceptions,
especially the ones who get suppressed in case of multiple exceptions.
---
 src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java')

diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index 2d0f8f70b..a779fed3b 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -322,10 +322,10 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
             }
         }
         if(null != tFBO) {
-            throw new GLException("GLFBODrawableImpl.reset(..) FBObject.reset(..) exception", tFBO);
+            throw GLException.newGLException(tFBO);
         }
         if(null != tGL) {
-            throw new GLException("GLFBODrawableImpl.reset(..) GLContext.release() exception", tGL);
+            throw GLException.newGLException(tGL);
         }
         if(DEBUG) {
             System.err.println("GLFBODrawableImpl.reset(newSamples "+newSamples+"): END "+this);
-- 
cgit v1.2.3