From d93c5d23e304ea20e868595748f92a5bef4f5703 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Fri, 28 Dec 2012 14:10:14 +0100
Subject: AWT GLCanvas: More strict GLDrawable realization [on AWT-EDT], skip
 if creation is not possible on AWT-EDT.

The Intel HD3000 OpenGL driver on Windows will deadlock @ SwapBuffers in case the drawable is created
on a thread other than the window owner thread.

We are aware of such possibilities, nevertheless the AWTEDTExecutor.singleton.invoke(..)
allowed to execute the runnable in case it cannot be invoked on AWT-EDT.
The latter is the case if the current thread is not the AWT-EDT _and_ is holding the AWT tree-lock.

With GlueGen commit 0b43b43f889ad7fc220942b0076e2001ca3cf13f, the invoke method now consumes
an argument allowing to restrict the execution to AWT-EDT only.

In such case, the drawable will be realized at a later time from the AWT-EDT.

Such a situation could be triggered if a Frame's setVisible(true)
is not issued from the AWT-EDT, as it should be!
However, to relax such use cases - we better recognize such possible dealock and avoid it.
---
 src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 1 +
 1 file changed, 1 insertion(+)

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

diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
index 2d062eaf1..c0c28a5f2 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
@@ -166,6 +166,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
     if ( realized != realizedArg ) { // volatile: OK (locked below)
         if(DEBUG) {
             System.err.println(getThreadName() + ": setRealized: "+getClass().getSimpleName()+" "+realized+" -> "+realizedArg);
+            Thread.dumpStack();
         }
         AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice();
         if(realizedArg) {
-- 
cgit v1.2.3