summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-04-23 02:00:27 +0200
committerMichael Bien <[email protected]>2010-04-23 02:00:27 +0200
commitb7bd092831a1ad7a660386c4c291cb363cd8ebb0 (patch)
treea52a2c5c34ecdfa91aa60f5615d36788259f1a28
parentc9b12606cf57c4ef255d88a65eb713ff9167c6de (diff)
reviewed calls to lockSurface() and ensured propper unlocking.
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java24
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java7
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java14
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java34
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/Window.java2
5 files changed, 37 insertions, 44 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
index 3286367e5..3864fc39c 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
@@ -60,21 +60,19 @@ public class EGLOnscreenDrawable extends EGLDrawable {
protected void swapBuffersImpl() {
boolean didLock = false;
+ if (!isSurfaceLocked()) {
+ // Usually the surface shall be locked within [makeCurrent .. swap .. release]
+ if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
+ return;
+ }
+ didLock = true;
+ }
try {
- if ( !isSurfaceLocked() ) {
- // Usually the surface shall be locked within [makeCurrent .. swap .. release]
- if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return;
- }
- didLock = true;
- }
-
- EGL.eglSwapBuffers(eglDisplay, eglSurface);
-
+ EGL.eglSwapBuffers(eglDisplay, eglSurface);
} finally {
- if(didLock) {
- unlockSurface();
- }
+ if (didLock) {
+ unlockSurface();
+ }
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
index 5816b2101..cf29d214b 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
@@ -87,11 +87,8 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
if( NativeWindow.LOCK_SURFACE_NOT_READY == lockSurface() ) {
throw new GLException("Couldn't lock surface");
}
- try {
- // don't remove this block .. locking the surface is essential to update surface data
- } finally {
- unlockSurface();
- }
+ // locking the surface is essential to update surface data
+ unlockSurface();
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
index fe0945139..43c1ff5e0 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
@@ -83,14 +83,14 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
protected void swapBuffersImpl() {
boolean didLock = false;
- try {
- if ( !isSurfaceLocked() ) {
- // Usually the surface shall be locked within [makeCurrent .. swap .. release]
- if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return;
- }
- didLock = true;
+ if ( !isSurfaceLocked() ) {
+ // Usually the surface shall be locked within [makeCurrent .. swap .. release]
+ if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
+ return;
}
+ didLock = true;
+ }
+ try {
long startTime = 0;
if (PROFILING) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java
index 2dabe774c..95dfc0a1c 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java
@@ -73,25 +73,23 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
}
}
- protected void swapBuffersImpl() {
- boolean didLock = false;
- try {
- if ( !isSurfaceLocked() ) {
- // Usually the surface shall be locked within [makeCurrent .. swap .. release]
- if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return;
- }
- didLock=true;
- }
-
- GLX.glXSwapBuffers(component.getDisplayHandle(), component.getSurfaceHandle());
-
- } finally {
- if(didLock) {
- unlockSurface();
- }
+ protected void swapBuffersImpl() {
+ boolean didLock = false;
+ if (!isSurfaceLocked()) {
+ // Usually the surface shall be locked within [makeCurrent .. swap .. release]
+ if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
+ return;
+ }
+ didLock = true;
+ }
+ try {
+ GLX.glXSwapBuffers(component.getDisplayHandle(), component.getSurfaceHandle());
+ } finally {
+ if (didLock) {
+ unlockSurface();
+ }
+ }
}
- }
//---------------------------------------------------------------------------
// Internals only below this point
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 5123ab19f..a3d034792 100755
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -342,8 +342,8 @@ public abstract class Window implements NativeWindow
keyListeners = new ArrayList();
}
synchronized(this) {
+ destructionLock.lock();
try {
- destructionLock.lock();
Display dpy = null;
if( null != screen && 0 != windowHandle ) {
Screen scr = screen;