Project: SWT
Bug 196737 [64] JUnit test crashes: Image constructor(Device,String)
Reported: 2007-07-16 17:28:27 | Status: resolved fixed

The following PI snippet used to reproduce the crash as well, but it no longer seems to since I've replaced swt with HEAD. The junit case still fails though. public static void main(String[] args) { Display display = new Display (); String filename="C:\\workspace33RC3\\org.eclipse.swt.tests\\bin\\folder.gif"; long /*int*/ [] token = new long /*int*/ [1]; GdiplusStartupInput input = new GdiplusStartupInput (); input.GdiplusVersion = 1; if (Gdip.GdiplusStartup (token, input, 0) != 0) { System.out.println("BAD"); } int length = filename.length(); char[] chars = new char[length+1]; filename.getChars(0, length, chars, 0); long bitmap = Gdip.Bitmap_new(null, false); long bitmapData = Gdip.BitmapData_new(); int pixelFormat = Gdip.Image_GetPixelFormat(bitmap); System.out.println(pixelFormat); Gdip.Bitmap_LockBits(bitmap, 0, 0, pixelFormat, bitmapData); Gdip.Bitmap_UnlockBits(bitmap, bitmapData); Gdip.BitmapData_delete(bitmapData); Gdip.Bitmap_delete(bitmap); display.dispose (); }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java