summaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/java/games/jogl/impl/x11/X11OnscreenGLDrawable.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/net/java/games/jogl/impl/x11/X11OnscreenGLDrawable.java b/src/net/java/games/jogl/impl/x11/X11OnscreenGLDrawable.java
index 0b66c51a7..a8308cf13 100644
--- a/src/net/java/games/jogl/impl/x11/X11OnscreenGLDrawable.java
+++ b/src/net/java/games/jogl/impl/x11/X11OnscreenGLDrawable.java
@@ -92,8 +92,25 @@ public class X11OnscreenGLDrawable extends X11GLDrawable {
public void swapBuffers() throws GLException {
lockAWT();
- GLX.glXSwapBuffers(display, drawable);
+ try {
+ boolean didLock = false;
+
+ if (drawable == 0) {
+ if (lockSurface() == LOCK_SURFACE_NOT_READY) {
+ return;
+ }
+
+ didLock = true;
+ }
+
+ GLX.glXSwapBuffers(display, drawable);
+
+ if (didLock) {
+ unlockSurface();
+ }
+ } finally {
unlockAWT();
+ }
}
public int lockSurface() throws GLException {