diff options
author | Sven Gothel <[email protected]> | 2012-05-14 16:34:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-05-14 16:34:49 +0200 |
commit | c066dc997646643a98c35b7c70183930284544d1 (patch) | |
tree | e33337401da8a0d765f0c671a539ee2003e0ce4e | |
parent | a338d1c94617f923609619d4edde7e1b1084cad5 (diff) |
Fix Bug 572: AWT-GLCanvas shall force setRealized(true) on AWT-EDT avoiding AWTTree deadlock
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 0d32655b9..0a75865e2 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -66,7 +66,6 @@ import javax.media.nativewindow.AbstractGraphicsScreen; import javax.media.nativewindow.GraphicsConfigurationFactory; import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; import javax.media.opengl.GL; import javax.media.opengl.GLAnimatorControl; @@ -92,6 +91,7 @@ import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol; import com.jogamp.nativewindow.awt.JAWTWindow; import com.jogamp.opengl.JoglVersion; +import jogamp.common.awt.AWTEDTExecutor; import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableHelper; @@ -550,10 +550,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private boolean validateGLDrawable() { boolean realized = false; if (!Beans.isDesignTime()) { - if ( null != drawable ) { + if ( null != drawable ) { // OK: drawable is volatile realized = drawable.isRealized(); if ( !realized && 0 < drawable.getWidth() * drawable.getHeight() ) { - drawable.setRealized(true); + // make sure drawable realization happens on AWT EDT, due to AWTTree lock + AWTEDTExecutor.singleton.invoke(true, setRealizedOnEventDispatchThreadAction); realized = true; sendReshape=true; // ensure a reshape is being send .. if(DEBUG) { @@ -565,6 +566,10 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } return realized; } + private Runnable setRealizedOnEventDispatchThreadAction = new Runnable() { + public void run() { + drawable.setRealized(true); + } }; /** <p>Overridden to track when this component is removed from a container. Subclasses which override this method must call |