aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl/GLProfile.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-17 10:47:13 +0100
committerSven Gothel <[email protected]>2010-11-17 10:47:13 +0100
commitd7e07a5638d1dffe47df572ae071eb4dabe52426 (patch)
tree6df84ea71fa0f6f71cff7d3d4644e3372a9d32f0 /src/jogl/classes/javax/media/opengl/GLProfile.java
parentb0b1e3fb9c0f915cdf8d237c0f61a9d08ca83b01 (diff)
Move shutdown hook registration to GLDrawableFactory.
Unregister the shutdown hook if called manually (recommended!).
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/GLProfile.java')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 878c4024e..02252ac33 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -103,7 +103,6 @@ public class GLProfile {
// since this skips checking further access
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
- registerFactoryShutdownHook();
initProfilesForDefaultDevices(firstUIActionOnProcess);
return null;
}
@@ -122,8 +121,9 @@ public class GLProfile {
/**
* Manual shutdown method, may be called after your last JOGL use
* within the running JVM.<br>
- * This method is called via the JVM shutdown hook.<br>
* It releases all temporary created resources, ie issues {@link javax.media.opengl.GLDrawableFactory#shutdown()}.<br>
+ * The shutdown implementation is called via the JVM shutdown hook, if not manually invoked here.<br>
+ * Invoke <code>shutdown()</code> manually is recommended, due to the unreliable JVM state within the shutdown hook.<br>
*/
public static synchronized void shutdown() {
if(initialized) {
@@ -1065,10 +1065,6 @@ public class GLProfile {
static boolean initialized = false;
- // Shutdown hook mechanism for the factory
- private static boolean factoryShutdownHookRegistered = false;
- private static Thread factoryShutdownHook = null;
-
/**
* Tries the profiles implementation and native libraries.
* Throws an GLException if no profile could be found at all.
@@ -1299,24 +1295,6 @@ public class GLProfile {
return defaultEGLDevice;
}
- private static synchronized void registerFactoryShutdownHook() {
- if (factoryShutdownHookRegistered) {
- return;
- }
- factoryShutdownHook = new Thread(new Runnable() {
- public void run() {
- GLDrawableFactory.shutdown();
- }
- });
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- Runtime.getRuntime().addShutdownHook(factoryShutdownHook);
- return null;
- }
- });
- factoryShutdownHookRegistered = true;
- }
-
private static void validateInitialization() {
if(!initialized) {
synchronized(GLProfile.class) {