aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java')
-rw-r--r--src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java b/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java
index 908257ba1..bab780219 100644
--- a/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java
+++ b/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java
@@ -59,6 +59,7 @@ public class X11OnscreenGLContext extends X11GLContext {
protected int makeCurrentImpl() throws GLException {
int lockRes = drawable.lockSurface();
+ boolean exceptionOccurred = false;
try {
if (lockRes == X11OnscreenGLDrawable.LOCK_SURFACE_NOT_READY) {
return CONTEXT_NOT_CURRENT;
@@ -67,11 +68,13 @@ public class X11OnscreenGLContext extends X11GLContext {
destroyImpl();
}
return super.makeCurrentImpl();
+ } catch (RuntimeException e) {
+ exceptionOccurred = true;
+ throw e;
} finally {
- if (isOptimizable()) {
- if (lockRes != X11OnscreenGLDrawable.LOCK_SURFACE_NOT_READY) {
- drawable.unlockSurface();
- }
+ if (exceptionOccurred ||
+ (isOptimizable() && lockRes != X11OnscreenGLDrawable.LOCK_SURFACE_NOT_READY)) {
+ drawable.unlockSurface();
}
}
}