summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com/sun/opengl/impl/windows')
-rw-r--r--src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java
index 00647e7dd..4e1dbd1c0 100644
--- a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java
+++ b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java
@@ -54,40 +54,21 @@ public class WindowsOnscreenGLContext extends WindowsGLContext {
}
protected int makeCurrentImpl() throws GLException {
+ int lockRes = 0;
try {
- int lockRes = drawable.lockSurface();
+ lockRes = drawable.lockSurface();
if (lockRes == WindowsOnscreenGLDrawable.LOCK_SURFACE_NOT_READY) {
return CONTEXT_NOT_CURRENT;
}
if (lockRes == WindowsOnscreenGLDrawable.LOCK_SURFACE_CHANGED) {
- if (hglrc != 0) {
- if (!WGL.wglDeleteContext(hglrc)) {
- throw new GLException("Unable to delete old GL context after surface changed");
- }
- GLContextShareSet.contextDestroyed(this);
- if (DEBUG) {
- System.err.println(getThreadName() + ": !!! Destroyed OpenGL context " + toHexString(hglrc) + " due to JAWT_LOCK_SURFACE_CHANGED");
- }
- hglrc = 0;
- }
+ destroyImpl();
}
int ret = super.makeCurrentImpl();
return ret;
- } catch (RuntimeException e) {
- try {
+ } finally {
+ if (lockRes != WindowsOnscreenGLDrawable.LOCK_SURFACE_NOT_READY) {
drawable.unlockSurface();
- } catch (Exception e2) {
- // do nothing if unlockSurface throws
}
- throw(e);
- }
- }
-
- protected void releaseImpl() throws GLException {
- try {
- super.releaseImpl();
- } finally {
- drawable.unlockSurface();
}
}
}