aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/windows
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2007-01-17 18:23:39 +0000
committerKenneth Russel <[email protected]>2007-01-17 18:23:39 +0000
commitda84904133c2375c00c4290e8731f67f681f30a2 (patch)
tree82f9bf470cc523937751a4f9e404ee2a154034b9 /src/classes/com/sun/opengl/impl/windows
parentb62f2e7e97b061f04d010121b4cd6f17dc5dad9a (diff)
Fixed Issue 260: "GLException: Surface already locked" after failed makeCurrent
Added checking for thrown run-time exceptions to on-screen GLContext makeCurrent() implementations on all three major supported platforms; now unlocks the underlying GLDrawable if an exception is thrown. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1088 232f8b59-042b-4e1e-8c03-345bb8c30851
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();
}
}
}