diff options
-rwxr-xr-x | src/classes/com/sun/opengl/util/JOGLAppletLauncher.java | 8 | ||||
-rw-r--r-- | src/classes/javax/media/opengl/GLCanvas.java | 13 | ||||
-rwxr-xr-x | src/classes/javax/media/opengl/Threading.java | 6 |
3 files changed, 26 insertions, 1 deletions
diff --git a/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java b/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java index ed0d9f296..303985b69 100755 --- a/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java +++ b/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java @@ -455,6 +455,14 @@ public class JOGLAppletLauncher extends Applet { displayError("Error opening jar file " + localJarFile.getName() + " for reading"); return; } + } else { + // Still need to discover whether DRI hack is installed + File[] files = installDir.listFiles(); + for (int i = 0; i < files.length; i++) { + if (files[i].getName().indexOf("jogl_drihack") >= 0) { + driHackPresent = true; + } + } } loadNativesAndStart(installDir); diff --git a/src/classes/javax/media/opengl/GLCanvas.java b/src/classes/javax/media/opengl/GLCanvas.java index 979c466c2..83072ffc5 100644 --- a/src/classes/javax/media/opengl/GLCanvas.java +++ b/src/classes/javax/media/opengl/GLCanvas.java @@ -169,7 +169,18 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { try { if (Threading.isSingleThreaded() && !Threading.isOpenGLThread()) { - Threading.invokeOnOpenGLThread(destroyAction); + // Workaround for termination issues with applets -- + // sun.applet.AppletPanel should probably be performing the + // remove() call on the EDT rather than on its own thread + if (Threading.isAWTMode() && + Thread.holdsLock(getTreeLock())) { + // The user really should not be invoking remove() from this + // thread -- but since he/she is, we can not go over to the + // EDT at this point. Try to destroy the context from here. + destroyAction.run(); + } else { + Threading.invokeOnOpenGLThread(destroyAction); + } } else { destroyAction.run(); } diff --git a/src/classes/javax/media/opengl/Threading.java b/src/classes/javax/media/opengl/Threading.java index 7475152e1..896e945d8 100755 --- a/src/classes/javax/media/opengl/Threading.java +++ b/src/classes/javax/media/opengl/Threading.java @@ -292,6 +292,12 @@ public class Threading { } } + /** This is a workaround for AWT-related deadlocks which only seem + to show up in the context of applets */ + static boolean isAWTMode() { + return (mode == AWT); + } + private static void printWorkaroundNotice() { if (singleThreaded && Debug.verbose()) { System.err.println("Using " + |