summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt
diff options
context:
space:
mode:
authorBilly Biggs <bbiggs>2005-09-29 18:04:48 +0000
committerBilly Biggs <bbiggs>2005-09-29 18:04:48 +0000
commit9a79fbd85cda981978050b58fe5d23529aaf1f11 (patch)
treeb668d158c53d07d2ccc82ac342db133579ef537f /bundles/org.eclipse.swt
parentfb6d2df828bbfcf96d146011227cfe339524c82e (diff)
downloadeclipse.platform.swt-9a79fbd85cda981978050b58fe5d23529aaf1f11.tar.gz
eclipse.platform.swt-9a79fbd85cda981978050b58fe5d23529aaf1f11.tar.xz
eclipse.platform.swt-9a79fbd85cda981978050b58fe5d23529aaf1f11.zip
Clean up properly when the pixel format is not supported.
Diffstat (limited to 'bundles/org.eclipse.swt')
-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);