Buggy code:
void createSurface ( ) { } void destroyMask ( ) { } public void dispose ( ) { } public boolean equals ( Object object ) { } public Color getBackground ( ) { } public Rectangle getBounds ( ) { } public ImageData getImageData ( ) { } public static Image gtk_new ( Device device , int type , int pixmap , int mask ) { } public int hashCode ( ) { } void init ( Device device , int width , int height ) { } void init ( Device device , ImageData image ) { if ( image == null ) SWT . error ( ERROR_NULL_ARGUMENT ) ; this . device = device ; int width = image . width ; int height = image . height ; PaletteData palette = image . palette ; if ( ! ( ( ( ( ( ( ( image . depth ) == 1 ) || ( ( image . depth ) == 2 ) ) || ( ( image . depth ) == 4 ) ) || ( ( image . depth ) == 8 ) ) && ( ! ( palette . isDirect ) ) ) || ( ( ( image . depth ) == 8 ) || ( ( ( ( ( image . depth ) == 16 ) || ( ( image . depth ) == 24 ) ) || ( ( image . depth ) == 32 ) ) && ( palette . isDirect ) ) ) ) ) SWT . error ( ERROR_UNSUPPORTED_DEPTH ) ; int pixbuf = OS . gdk_pixbuf_new ( GDK_COLORSPACE_RGB , false , 8 , width , height ) ; if ( pixbuf == 0 ) SWT . error ( ERROR_NO_HANDLES ) ; int stride = OS . gdk_pixbuf_get_rowstride ( pixbuf ) ; int data = OS . gdk_pixbuf_get_pixels ( pixbuf ) ; byte [ ] buffer = image . data ; if ( ( ( ( ( ( ! ( palette . isDirect ) ) || ( ( image . depth ) != 24 ) ) || ( stride != ( image . bytesPerLine ) ) ) || ( ( palette . redMask ) != 16711680 ) ) || ( ( palette . greenMask ) != 65280 ) ) || ( ( palette . blueMask ) != 255 ) ) { buffer = new byte [ stride * height ] ; if ( palette . isDirect ) { ImageData . blit ( BLIT_SRC , image . data , image . depth , image . bytesPerLine , image . getByteOrder ( ) , 0 , 0 , width , height , palette . redMask , palette . greenMask , palette . blueMask , ALPHA_OPAQUE , null , 0 , 0 , 0 , buffer , 24 , stride , MSB_FIRST , 0 , 0 , width , height , 16711680 , 65280 , 255 , false , false ) ; } else { RGB [ ] rgbs = palette . getRGBs ( ) ; int length = rgbs . length ; byte [ ] srcReds = new byte [ length ] ; byte [ ] srcGreens = new byte [ length ] ; byte [ ] srcBlues = new byte [ length ] ; for ( int i = 0 ; i < ( rgbs . length ) ; i ++ ) { RGB rgb = rgbs [ i ] ; if ( rgb == null ) continue ; srcReds [ i ] = ( ( byte ) ( rgb . red ) ) ; srcGreens [ i ] = ( ( byte ) ( rgb . green ) ) ; srcBlues [ i ] = ( ( byte ) ( rgb . blue ) ) ; } ImageData . blit ( BLIT_SRC , image . data , image . depth , image . bytesPerLine , image . getByteOrder ( ) , 0 , 0 , width , height , srcReds , srcGreens , srcBlues , ALPHA_OPAQUE , null , 0 , 0 , 0 , buffer , 24 , stride , MSB_FIRST , 0 , 0 , width , height , 16711680 , 65280 , 255 , false , false ) ; } } <START_BUG> OS . memmove ( data , buffer , buffer . length ) ; <END_BUG> int pixmap = OS . gdk_pixmap_new ( OS . GDK_ROOT_PARENT ( ) , width , height , ( - 1 ) ) ; if ( pixmap == 0 ) SWT . error ( ERROR_NO_HANDLES ) ; int gdkGC = OS . gdk_gc_new ( pixmap ) ; if ( gdkGC == 0 ) SWT . error ( ERROR_NO_HANDLES ) ; OS . gdk_pixbuf_render_to_drawable ( pixbuf , pixmap , gdkGC , 0 , 0 , 0 , 0 , width , height , GDK_RGB_DITHER_NORMAL , 0 , 0 ) ; OS . g_object_unref ( gdkGC ) ; OS . g_object_unref ( pixbuf ) ; boolean isIcon = ( image . getTransparencyType ( ) ) == ( SWT . TRANSPARENCY_MASK ) ; if ( isIcon || ( ( image . transparentPixel ) != ( - 1 ) ) ) { if ( ( image . transparentPixel ) != ( - 1 ) ) { RGB rgb = null ; if ( palette . isDirect ) { rgb = palette . getRGB ( image . transparentPixel ) ; } else { if ( ( image . transparentPixel ) < ( palette . colors . length ) ) { rgb = palette . getRGB ( image . transparentPixel ) ; } } if ( rgb != null ) { transparentPixel = ( ( ( rgb . red ) << 16 ) | ( ( rgb . green ) << 8 ) ) | ( rgb . blue ) ; } } int mask = createMask ( image , isIcon ) ; if ( mask == 0 ) SWT . error ( ERROR_NO_HANDLES ) ; this . mask = mask ;

Fix:
OS . memmove ( data , buffer , ( stride * height ) ) ;