From c298b4317a30cc453a2350ebeb5ab3570a4c107d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 22 Sep 2014 07:07:42 +0200 Subject: Stabilize, fix regression: GLDrawable.invoke(..) and Animator* display-loop 'closure' GLDrawable.invoke(..) regression of commit c77b8f586cb2553582a42f5b90aeee5ef85f1efe: 'wait' was not set to false, if 'deferredHere' was forced to 'false'. This could lead to the situation where GLRunnableTask will catch the exception and supresses it. Animator/FPSAnimator post exception propagation code animThread = null; notifyAll(); must be complete to finalize animator state in case of an exception. Decorate 'handleUncaughtException(..)' w/ try { } finally { } where the latter ensures the mentioned 'closure'. --- make/scripts/tests-win.bat | 5 +++-- make/scripts/tests.sh | 4 ++-- src/jogl/classes/com/jogamp/opengl/util/Animator.java | 11 +++++++---- src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java | 11 +++++++---- src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 2 ++ 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat index a4561e984..6bf2d97f0 100755 --- a/make/scripts/tests-win.bat +++ b/make/scripts/tests-win.bat @@ -1,5 +1,5 @@ REM scripts\java-win.bat jogamp.newt.awt.opengl.VersionApplet -scripts\java-win.bat com.jogamp.newt.opengl.GLWindow +REM scripts\java-win.bat com.jogamp.newt.opengl.GLWindow REM scripts\java-win.bat javax.media.opengl.awt.GLCanvas REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT %* REM scripts\java-win.bat com.jogamp.oculusvr.OVRVersion %* @@ -82,7 +82,8 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDr REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch11NEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug00NEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug01NEWT %* -REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT %* +scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLException01NEWT %* + REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestMapBuffer01NEWT REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext01NEWT %* diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 2fe9caadd..a36342d85 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -477,13 +477,13 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.math.TestQuaternion01NOUI $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrent01NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrent01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrent02NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextSurfaceLockNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug00NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLException01NEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLException01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMapBufferRead01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT $* diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index 4d61adaa6..c7a03eddb 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -237,11 +237,14 @@ public class Animator extends AnimatorBase { stopIssued = false; pauseIssued = false; isAnimating = false; - if( null != displayCaught ) { - handleUncaughtException(displayCaught); + try { + if( null != displayCaught ) { + handleUncaughtException(displayCaught); // may throw exception if null handler + } + } finally { + animThread = null; + Animator.this.notifyAll(); } - animThread = null; - Animator.this.notifyAll(); } } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java index ec6c8aae7..dc4a9a896 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java @@ -232,11 +232,14 @@ public class FPSAnimator extends AnimatorBase { } } isAnimating = false; - if( null != displayCaught ) { - handleUncaughtException(displayCaught); + try { + if( null != displayCaught ) { + handleUncaughtException(displayCaught); // may throw exception if null handler + } + } finally { + animThread = null; + FPSAnimator.this.notifyAll(); } - animThread = null; - FPSAnimator.this.notifyAll(); } } } diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index edf20cc62..ec0d85c91 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -898,6 +898,7 @@ public class GLDrawableHelper { if( isGLThread ) { // Run immediately, don't defer since locked by this thread, but isGLThread deferredHere = false; + wait = false; } else { // Locked by this thread, but _not_ isGLThread -> ERROR throw new IllegalStateException("Deferred, wait, isLocked on current and not GL-Thread: thread "+Thread.currentThread()); @@ -963,6 +964,7 @@ public class GLDrawableHelper { if( isGLThread ) { // Run immediately, don't defer since locked by this thread, but isGLThread deferredHere = false; + wait = false; } else { // Locked by this thread, but _not_ isGLThread -> ERROR throw new IllegalStateException("Deferred, wait, isLocked on current and not GL-Thread: thread "+Thread.currentThread()); -- cgit v1.2.3