Buggy code:
class Safari extends WebBrowser { int delegate ; int webViewHandle ; int windowBoundsHandler ; boolean changingLocation ; String lastHoveredLinkURL ; String html ; int identifier ; int resourceCount ; int lastMouseMoveX ; int lastMouseMoveY ; String url = "" ; Point location ; Point size ; boolean statusBar = true ; boolean toolBar = true ; boolean ignoreDispose ; static boolean Initialized ; static Callback Callback3 ; static Callback Callback7 ; static final int MIN_SIZE = 16 ; static final int MAX_PROGRESS = 100 ; static final String WebElementLinkURLKey = "WebElementLinkURL" ; static final String AGENT_STRING = "Safari//412.0" ; static final String URI_FROMMEMORY = "file://////" ; static final String PROTOCOL_FILE = "file:" ; static final String PROTOCOL_HTTP = "http:" ; static final String URI_APPLEWEBDATA = "applewebdata:////" ; static final String ABOUT_BLANK = "about:blank" ; static final String ADD_WIDGET_KEY = "org.eclipse.swt.internal.addWidget" ; static final String BROWSER_WINDOW = "org.eclipse.swt.browser.Browser.Window" ; static final String BROWSER_COCOA_BUTTON = "org.eclipse.swt.browser.Browser.CocoaButton" ; static final String SAFARI_EVENTS_FIX_KEY = "org.eclipse.swt.internal.safariEventsFix" ; static final String DOMEVENT_KEYUP = "keyup" ; static final String DOMEVENT_KEYDOWN = "keydown" ; static final String DOMEVENT_MOUSEDOWN = "mousedown" ; static final String DOMEVENT_MOUSEUP = "mouseup" ; static final String DOMEVENT_MOUSEMOVE = "mousemove" ; static final String DOMEVENT_MOUSEWHEEL = "mousewheel" ; public void create ( Composite parent , int style ) { if ( ( OS . VERSION ) < 4144 ) { browser . dispose ( ) ; SWT . error ( ERROR_NO_HANDLES ) ; } if ( ( OS . VERSION ) >= 4176 ) { Shell shell = parent . getShell ( ) ; if ( ( shell . getData ( Safari . BROWSER_COCOA_BUTTON ) ) == null ) { int [ ] root = new int [ 1 ] ; OS . HIViewFindByID ( OS . HIViewGetRoot ( OS . GetControlOwner ( parent . handle ) ) , OS . kHIViewWindowContentID ( ) , root ) ; int rootHandle = root [ 0 ] ; <START_BUG> int buttonHandle = Cocoa . objc_msgSend ( Cocoa . objc_msgSend ( Cocoa . objc_getClass ( "NSButton" ) , S_alloc ) , S_initWithFrame , 0 ) ; <END_BUG> int [ ] outControl = new int [ 1 ] ; Cocoa . HICocoaViewCreate ( buttonHandle , 0 , outControl ) ; OS . HIViewSetFrame ( outControl [ 0 ] , new CGRect ( ) ) ; OS . HIViewSetVisible ( outControl [ 0 ] , false ) ; OS . HIViewAddSubview ( rootHandle , outControl [ 0 ] ) ; OS . DisposeControl ( outControl [ 0 ] ) ; shell . setData ( Safari . BROWSER_COCOA_BUTTON , "true" ) ; } } int [ ] outControl = new int [ 1 ] ; try { Cocoa . HIWebViewCreate ( outControl ) ; } catch ( UnsatisfiedLinkError e ) { browser . dispose ( ) ; SWT . error ( ERROR_NO_HANDLES ) ; } webViewHandle = outControl [ 0 ] ; if ( ( webViewHandle ) == 0 ) { browser . dispose ( ) ; SWT . error ( ERROR_NO_HANDLES ) ; } Display display = browser . getDisplay ( ) ; display . setData ( Safari . ADD_WIDGET_KEY , new Object [ ] { new Integer ( webViewHandle ) , browser } ) ; if ( ! ( ( OS . VERSION ) < 4160 ) ) { browser . setData ( Safari . SAFARI_EVENTS_FIX_KEY ) ; } if ( ( display . getData ( Safari . BROWSER_WINDOW ) ) == null ) { Rect bounds = new Rect ( ) ; OS . SetRect ( bounds , ( ( short ) ( 0 ) ) , ( ( short ) ( 0 ) ) , ( ( short ) ( 1 ) ) , ( ( short ) ( 1 ) ) ) ; final int [ ] outWindow = new int [ 1 ] ; OS . CreateNewWindow ( kOverlayWindowClass , 0 , bounds , outWindow ) ; OS . ShowWindow ( outWindow [ 0 ] ) ; OS . HIObjectSetAccessibilityIgnored ( outWindow [ 0 ] , true ) ; display . disposeExec ( new Runnable ( ) { public void run ( ) { if ( ( outWindow [ 0 ] ) != 0 ) { OS . DisposeWindow ( outWindow [ 0 ] ) ; } outWindow [ 0 ] = 0 ; } } ) ; display . setData ( Safari . BROWSER_WINDOW , outWindow ) ; } int window = OS . GetControlOwner ( handle ) ; int [ ] contentView = new int [ 1 ] ; OS . HIViewFindByID ( OS . HIViewGetRoot ( window ) , OS . kHIViewWindowContentID ( ) , contentView ) ; OS . HIViewAddSubview ( contentView [ 0 ] , webViewHandle ) ; OS . HIViewChangeFeatures ( webViewHandle , kHIViewFeatureIsOpaque , 0 ) ; OS . HIViewSetVisible ( webViewHandle , true ) ; if ( browser . getShell ( ) . isVisible ( ) ) { int [ ] showEvent = new int [ 1 ] ; OS . CreateEvent ( 0 , kEventClassWindow , kEventWindowShown , 0.0 , kEventAttributeUserEvent , showEvent ) ; OS . SetEventParameter ( showEvent [ 0 ] , kEventParamDirectObject , typeWindowRef , 4 , new int [ ] { OS . GetControlOwner ( handle ) } ) ; OS . SendEventToEventTarget ( showEvent [ 0 ] , OS . GetWindowEventTarget ( window ) ) ; if ( ( showEvent [ 0 ] ) != 0 ) OS . ReleaseEvent ( showEvent [ 0 ] ) ; } final int webView = Cocoa . HIWebViewGetWebView ( webViewHandle ) ; final int notificationCenter = Cocoa . objc_msgSend ( C_NSNotificationCenter , S_defaultCenter ) ; Listener listener = new Listener ( ) { public void handleEvent ( Event e ) { switch ( e . type ) { case SWT . Dispose : { if ( ignoreDispose ) { ignoreDispose = false ; break ; } ignoreDispose = true ; browser . notifyListeners ( e . type , e ) ;

Fix:
int buttonHandle = Cocoa . objc_msgSend ( Cocoa . objc_msgSend ( C_NSButton , S_alloc ) , S_initWithFrame , new NSRect ( ) ) ;