diff options
author | Sven Gothel <[email protected]> | 2012-10-05 19:11:26 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-05 19:11:26 +0200 |
commit | bb8454d735c511c6d80798d3b6258e1ed355579e (patch) | |
tree | ab7ed29ba38c4005434257e5db89390023fad736 | |
parent | 67c2ab9bbc3522d85977151849c416f5aa320395 (diff) |
Refine a3cb6bb14f410f67fccf5ccd4cd7ecc66f448389, fix deadlock (regression)
The lock being claimed at validateGLDrawable() is 'offthread', i.e. may fight w/ AWT / Animator
at reshape/display.
Locking is moved 'down' to AWT runnable 'setRealizedOnEDTAction', which also double checks
the drawable [again].
-rwxr-xr-x | make/scripts/tests.sh | 14 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 46 |
2 files changed, 39 insertions, 21 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 8b554b923..f76e2b1f8 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -73,6 +73,7 @@ function jrun() { #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLDrawable -Dnativewindow.debug.GraphicsConfiguration" + #D_ARGS="-Djogl.debug.GLDrawable" #D_ARGS="-Djogl.fbo.force.none" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all -Djogamp.debug.Lock" #D_ARGS="-Djogl.debug=all" @@ -259,11 +260,10 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitchNEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryOffscrnCapsNEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryOffscrnCapsNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer01GLCanvasAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer02NewtCanvasAWT $* @@ -458,6 +458,16 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryOffsc #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $* +#linux: +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT $* +#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode01bNEWT +#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode01NEWT +#testawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol01AWT $* +testawt com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyAWT $* +#testawt com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411 $* +#testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWTCardLayoutAnimatorStartStopBug532 $* + + $spath/count-edt-start.sh java-run.log diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 4bdae7135..a5c15dbda 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -576,29 +576,37 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if( _drawable.isRealized() ) { return true; } - final RecursiveLock _lock = lock; - _lock.lock(); - try { - if (!Beans.isDesignTime() && isDisplayable() && - 0 < _drawable.getWidth() && 0 < _drawable.getHeight() ) { - // make sure drawable realization happens on AWT EDT, due to AWTTree lock - AWTEDTExecutor.singleton.invoke(getTreeLock(), true, setRealizedOnEDTAction); - if( _drawable.isRealized() ) { - sendReshape=true; // ensure a reshape is being send .. - if(DEBUG) { - System.err.println(getThreadName()+": Realized Drawable: "+_drawable.toString()); - Thread.dumpStack(); - } - return true; - } - } - } finally { - _lock.unlock(); + if( Beans.isDesignTime() || !isDisplayable() || 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) { + return false; // early out! + } + // make sure drawable realization happens on AWT EDT, due to AWTTree lock + AWTEDTExecutor.singleton.invoke(getTreeLock(), true, setRealizedOnEDTAction); + final boolean res = _drawable.isRealized(); + if(DEBUG) { + System.err.println(getThreadName()+": Realized Drawable: "+res+", "+_drawable.toString()); + Thread.dumpStack(); } + return res; } return false; } - private Runnable setRealizedOnEDTAction = new Runnable() { public void run() { drawable.setRealized(true); } }; + private Runnable setRealizedOnEDTAction = new Runnable() { + public void run() { + final RecursiveLock _lock = lock; + _lock.lock(); + try { + final GLDrawable _drawable = drawable; + if( null == _drawable || 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) { + return; + } + _drawable.setRealized(true); + if( _drawable.isRealized() ) { + sendReshape=true; // ensure a reshape is being send .. + } + } finally { + _lock.unlock(); + } + } }; /** <p>Overridden to track when this component is removed from a container. Subclasses which override this method must call |