From 1d2e9cdca89e83339814abff38790367b33e6523 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Thu, 15 Oct 2009 00:24:36 -0700
Subject: Fix Solaris build

---
 .../windows/wgl/WindowsPbufferWGLDrawable.java     | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)

(limited to 'src/jogl/classes')

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;
     }
   }
 
-- 
cgit v1.2.3