From 919aabb77250cb0e272dac228388592d08bf98f5 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 1 Dec 2011 18:32:22 +0100 Subject: GLContext fix shutdown(): Clear proc address tables and extension cache (GLContextImpl) --- src/jogl/classes/javax/media/opengl/GLContext.java | 9 ++++++--- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 31125af59..38c2d79e5 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -66,7 +66,8 @@ import jogamp.opengl.GLContextImpl; abstraction provides a stable object which clients can use to refer to a given context. */ public abstract class GLContext { - + public static final boolean DEBUG = Debug.debug("GLContext"); + /** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */ public final static boolean DEBUG_GL; /** Reflects property jogl.debug.TraceGL. If true, the trace pipeline is enabled at context creation. */ @@ -792,16 +793,18 @@ public abstract class GLContext { throw new InternalError("Already set: "+devKey); } deviceVersionsAvailableSet.add(devKey); - if (GLContextImpl.DEBUG) { + if (DEBUG) { System.err.println(getThreadName() + ": !!! createContextARB: SET mappedVersionsAvailableSet "+devKey); // Thread.dumpStack(); } } } + /** clears the device/context mappings as well as the GL/GLX proc address tables. */ protected static void shutdown() { deviceVersionAvailable.clear(); - deviceVersionsAvailableSet.clear(); + deviceVersionsAvailableSet.clear(); + GLContextImpl.shutdownImpl(); // well .. } /** diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index d43c2d99d..5ea1a9bac 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -69,8 +69,6 @@ import javax.media.opengl.GLPipelineFactory; import javax.media.opengl.GLProfile; public abstract class GLContextImpl extends GLContext { - public static final boolean DEBUG = Debug.debug("GLContext"); - // RecursiveLock maintains a queue of waiting Threads, ensuring the longest waiting thread will be notified at unlock. protected RecursiveLock lock = LockFactory.createRecursiveLock(); @@ -113,6 +111,12 @@ public abstract class GLContextImpl extends GLContext { mappedGLXProcAddress = new HashMap(); } + public static void shutdownImpl() { + mappedExtensionAvailabilityCache.clear(); + mappedGLProcAddress.clear(); + mappedGLXProcAddress.clear(); + } + public GLContextImpl(GLDrawableImpl drawable, GLContext shareWith) { super(); -- cgit v1.2.3