aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com')
-rw-r--r--src/classes/com/sun/opengl/impl/GLContextImpl.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java
index 795b06e9a..a4eee6652 100644
--- a/src/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java
@@ -81,6 +81,21 @@ public abstract class GLContextImpl extends GLContext {
}
public int makeCurrent() throws GLException {
+ // Support calls to makeCurrent() over and over again with
+ // different contexts without releasing them
+ // Could implement this more efficiently without explicit
+ // releasing of the underlying context; would require more error
+ // checking during the makeCurrentImpl phase
+ GLContext current = getCurrent();
+ if (current != null) {
+ if (current == this) {
+ // Assume we don't need to make this context current again
+ return CONTEXT_CURRENT;
+ } else {
+ current.release();
+ }
+ }
+
lock.lock();
int res = 0;
try {