From c75dcfed13f2ca830284cff4bc99f3e921a873fa Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Wed, 22 Mar 2006 22:18:21 +0000 Subject: Fixed Issue 210: Crashes on Mac OS X related to GLWorkerThread Worked around crashes related to introduction of GLWorkerThread by switching back to using the AWT event dispatch thread to perform all OpenGL work on Mac OS X. It is possible that there are deeper underlying bugs in the new locking protocol for on-screen GLContext implementations and that a more correct fix can be found in the future. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@675 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/classes/javax/media/opengl/Threading.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/classes') diff --git a/src/classes/javax/media/opengl/Threading.java b/src/classes/javax/media/opengl/Threading.java index 94de9e7d9..6c6d69919 100755 --- a/src/classes/javax/media/opengl/Threading.java +++ b/src/classes/javax/media/opengl/Threading.java @@ -122,18 +122,25 @@ public class Threading { private static boolean singleThreaded = true; private static final int AWT = 1; private static final int WORKER = 2; - private static int mode = WORKER; + private static int mode; static { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { String workaround = System.getProperty("opengl.1thread"); + // Default to using the AWT thread on OS X due to apparent + // instability with using JAWT on non-AWT threads + boolean isOSX = System.getProperty("os.name").equals("Mac OS X"); + int defaultMode = (isOSX ? AWT : WORKER); + mode = defaultMode; if (workaround != null) { workaround = workaround.toLowerCase(); if (workaround.equals("true") || - workaround.equals("auto") || - workaround.equals("worker")) { - // Nothing to do; default = singleThreaded, mode = WORKER + workaround.equals("auto")) { + // Nothing to do; singleThreaded and mode already set up + } else if (workaround.equals("worker")) { + singleThreaded = true; + mode = WORKER; } else if (workaround.equals("awt")) { singleThreaded = true; mode = AWT; -- cgit v1.2.3