diff options
Diffstat (limited to 'src')
3 files changed, 9 insertions, 5 deletions
diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java index 3f08b084e..9b60cd77a 100644 --- a/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java @@ -54,9 +54,8 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext { } protected int makeCurrentImpl() throws GLException { - int lockRes = 0; + int lockRes = drawable.lockSurface(); try { - lockRes = drawable.lockSurface(); if (lockRes == MacOSXOnscreenGLDrawable.LOCK_SURFACE_NOT_READY) { return CONTEXT_NOT_CURRENT; } diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java index 4f41cd8e1..e6a0d432f 100644 --- a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java @@ -54,9 +54,8 @@ public class WindowsOnscreenGLContext extends WindowsGLContext { } protected int makeCurrentImpl() throws GLException { - int lockRes = 0; + int lockRes = drawable.lockSurface(); try { - lockRes = drawable.lockSurface(); if (lockRes == WindowsOnscreenGLDrawable.LOCK_SURFACE_NOT_READY) { return CONTEXT_NOT_CURRENT; } diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java index 08902b573..ee8393296 100644 --- a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java @@ -194,7 +194,13 @@ public class WindowsOnscreenGLDrawable extends WindowsGLDrawable { return LOCK_SURFACE_NOT_READY; } if (!pixelFormatChosen) { - choosePixelFormat(true); + try { + choosePixelFormat(true); + } catch (RuntimeException e) { + // Make it look like the lockSurface() call didn't succeed + unlockSurface(); + throw e; + } } if (PROFILING) { long endTime = System.currentTimeMillis(); |