summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/opengl/GLCanvas.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OpenGL/motif/org/eclipse/swt/opengl/GLCanvas.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java7
4 files changed, 14 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/opengl/GLCanvas.java
index 3a80d6f1c1..26b1b0c37d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/opengl/GLCanvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/opengl/GLCanvas.java
@@ -104,6 +104,10 @@ public GLCanvas (Composite parent, int style, GLData data) {
}
aglAttrib [pos++] = AGL.AGL_NONE;
pixelFormat = AGL.aglChoosePixelFormat (0, 0, aglAttrib);
+ if (pixelFormat == 0) {
+ dispose ();
+ SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH);
+ }
//FIXME- share lists
//context = AGL.aglCreateContext (pixelFormat, share == null ? 0 : share.context);
context = AGL.aglCreateContext (pixelFormat, 0);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java
index 2ca9859afa..8b7b0c247d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java
@@ -109,7 +109,10 @@ public GLCanvas (Composite parent, int style, GLData data) {
int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle);
int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window);
int /*long*/ infoPtr = GLX.glXChooseVisual (xDisplay, OS.XDefaultScreen (xDisplay), glxAttrib);
- if (infoPtr == 0) SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH);
+ if (infoPtr == 0) {
+ dispose ();
+ SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH);
+ }
vinfo = new XVisualInfo ();
GLX.memmove (vinfo, infoPtr, XVisualInfo.sizeof);
OS.XFree (infoPtr);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/motif/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/motif/org/eclipse/swt/opengl/GLCanvas.java
index 8ab047b551..00d8eeb36b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/motif/org/eclipse/swt/opengl/GLCanvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/motif/org/eclipse/swt/opengl/GLCanvas.java
@@ -112,7 +112,10 @@ public GLCanvas (Composite parent, int style, GLData data) {
int xDisplay = OS.XtDisplay (handle);
int xScreen = OS.XDefaultScreen (xDisplay);
int infoPtr = GLX.glXChooseVisual (xDisplay, xScreen, glxAttrib);
- if (infoPtr == 0) SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH);
+ if (infoPtr == 0) {
+ dispose ();
+ SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH);
+ }
vinfo = new XVisualInfo ();
GLX.memmove (vinfo, infoPtr, XVisualInfo.sizeof);
OS.XFree (infoPtr);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java
index c31eca0804..f7e19c6f41 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java
@@ -78,12 +78,9 @@ public GLCanvas (Composite parent, int style, GLData data) {
int hDC = OS.GetDC (handle);
pixelFormat = WGL.ChoosePixelFormat (hDC, pfd);
- if (pixelFormat == 0) {
- OS.ReleaseDC (handle, hDC);
- SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- if (!WGL.SetPixelFormat (hDC, pixelFormat, pfd)) {
+ if (pixelFormat == 0 || !WGL.SetPixelFormat (hDC, pixelFormat, pfd)) {
OS.ReleaseDC (handle, hDC);
+ dispose ();
SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH);
}
context = WGL.wglCreateContext (hDC);