diff options
author | Sven Gothel <[email protected]> | 2014-08-06 05:59:08 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-08-06 05:59:08 +0200 |
commit | 88eef9e4eae8e63762252f1d11bca2bd0fde809b (patch) | |
tree | 1a70cb2f54ada3a654928ec30432d5fca6ef822e /src/newt/classes/jogamp | |
parent | 07a4801f3b5bfd4fba9a1a4a542ce2f2eae4396a (diff) |
Bug 1039 - Specify behavior of GLEventListener Exceptions occurring while GLAutoDrawable processing [part-3]
Add GLAnimatorControl.UncaughtGLAnimatorExceptionHandler interface to optionally handle
uncaught exception within an animator thread by the user.
Implementation also requires to flush all enqueued GLRunnable instances
via GLAutoDrawable.invoked(..) in case such exception occurs.
Hence 'GLAutoDrawable.flushGLRunnables()' has been added.
Only subsequent exceptions, which cannot be thrown are dumped to System.stderr.
+++
Handling of exceptions during dispose()
Exception in NEWT's disposeGL*() are also caught and re-thrown after
the NEWT window has been destroyed in WindowImpl.destroyAction:
- GLEventListener.dispose(..)
- GLDrawableHelper.disposeAllGLEventListener(..)
- GLDrawableHelper.disposeGL(..)
- GLAutoDrawableBase.destroyImplInLock(..)
- GLWindow.GLLifecycleHook.destroyActionInLock(..)
- WindowImpl.destroyAction on NEWT-EDT
- WindowImpl.destroy
Further more, exceptions occuring in native windowing toolkit triggered destroy()
are ignored:
- GLAutoDrawableBase.defaultWindowDestroyNotifyOp(..)
It has to be seen whether such exception handling for
dispose() shall be added to AWT/SWT.
+++
TestGLException01NEWT covers all GLEventListener exception cases
on-thread and off-thread (via animator).
+++
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index ca6ffa18b..b62628962 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -1104,6 +1104,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(null!=lifecycleHook) { lifecycleHook.destroyActionPreLock(); } + RuntimeException lifecycleCaughtInLock = null; final RecursiveLock _lock = windowLock; _lock.lock(); try { @@ -1133,7 +1134,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(null!=lifecycleHook) { // send synced destroy notification for proper cleanup, eg GLWindow/OpenGL - lifecycleHook.destroyActionInLock(); + try { + lifecycleHook.destroyActionInLock(); + } catch (final RuntimeException re) { + lifecycleCaughtInLock = re; + } } if( isNativeValid() ) { @@ -1156,6 +1161,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("Window.destroy() END "+getThreadName()/*+", "+WindowImpl.this*/); + if( null != lifecycleCaughtInLock ) { + System.err.println("Window.destroy() caught: "+lifecycleCaughtInLock.getMessage()); + lifecycleCaughtInLock.printStackTrace(); + } + } + if( null != lifecycleCaughtInLock ) { + throw lifecycleCaughtInLock; } } finally { // update states before release window lock |