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.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java
index e6a0d432f..066cb8fa6 100644
--- a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java
+++ b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java
@@ -55,6 +55,7 @@ public class WindowsOnscreenGLContext extends WindowsGLContext {
protected int makeCurrentImpl() throws GLException {
int lockRes = drawable.lockSurface();
+ boolean exceptionOccurred = false;
try {
if (lockRes == WindowsOnscreenGLDrawable.LOCK_SURFACE_NOT_READY) {
return CONTEXT_NOT_CURRENT;
@@ -64,11 +65,13 @@ public class WindowsOnscreenGLContext extends WindowsGLContext {
}
int ret = super.makeCurrentImpl();
return ret;
+ } catch (RuntimeException e) {
+ exceptionOccurred = true;
+ throw e;
} finally {
- if (isOptimizable()) {
- if (lockRes != WindowsOnscreenGLDrawable.LOCK_SURFACE_NOT_READY) {
- drawable.unlockSurface();
- }
+ if (exceptionOccurred ||
+ (isOptimizable() && lockRes != WindowsOnscreenGLDrawable.LOCK_SURFACE_NOT_READY)) {
+ drawable.unlockSurface();
}
}
}