summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java30
-rwxr-xr-xsrc/newt/native/X11Window.c11
2 files changed, 21 insertions, 20 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
index 2bc6660fb..c324b1ce1 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -81,20 +81,22 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
public void destroy() {
NativeWindow nw = getNativeWindow();
- if (nw.getSurfaceHandle() != 0) {
- // Must release DC and pbuffer
- // NOTE that since the context is not current, glGetError() can
- // not be called here, so we skip the use of any composable
- // pipelines (see WindowsOnscreenWGLContext.makeCurrentImpl)
- WGLExt wglExt = cachedWGLExt;
- if (wglExt.wglReleasePbufferDCARB(buffer, nw.getSurfaceHandle()) == 0) {
- throw new GLException("Error releasing pbuffer device context: error code " + WGL.GetLastError());
- }
- ((SurfaceChangeable)nw).setSurfaceHandle(0);
- if (!wglExt.wglDestroyPbufferARB(buffer)) {
- throw new GLException("Error destroying pbuffer: error code " + WGL.GetLastError());
- }
- buffer = 0;
+ if(0!=buffer) {
+ WGLExt wglExt = cachedWGLExt;
+ if (nw.getSurfaceHandle() != 0) {
+ // Must release DC and pbuffer
+ // NOTE that since the context is not current, glGetError() can
+ // not be called here, so we skip the use of any composable
+ // pipelines (see WindowsOnscreenWGLContext.makeCurrentImpl)
+ if (wglExt.wglReleasePbufferDCARB(buffer, nw.getSurfaceHandle()) == 0) {
+ throw new GLException("Error releasing pbuffer device context: error code " + WGL.GetLastError());
+ }
+ ((SurfaceChangeable)nw).setSurfaceHandle(0);
+ }
+ if (!wglExt.wglDestroyPbufferARB(buffer)) {
+ throw new GLException("Error destroying pbuffer: error code " + WGL.GetLastError());
+ }
+ buffer = 0;
}
}
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index 097d68cca..b6b2bbe26 100755
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -397,6 +397,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
// Periodically take a break
while( num_events > 0 ) {
+ jobject jwindow = NULL;
+ XEvent evt;
+ KeySym keySym;
+ char keyChar;
+ char text[255];
XLockDisplay(dpy) ;
@@ -407,12 +412,6 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
return;
}
- jobject jwindow = NULL;
- XEvent evt;
- KeySym keySym;
- char keyChar;
- char text[255];
-
XNextEvent(dpy, &evt);
num_events--;