Buggy code:
public class Shell extends Decorations { Region region ; Control lastActive ; boolean closing ; boolean moved ; boolean resized ; boolean opened ; boolean fullScreen ; int oldX ; int oldY ; int oldWidth ; int oldHeight ; int oldWindowStyle ; int oldWindowState ; public Shell ( ) { } public Shell ( int style ) { } public Shell ( Display display ) { } public Shell ( Display display , int style ) { } Shell ( Display display , Shell parent , int style , int handle , boolean embedded ) { } public Shell ( Shell parent ) { } public Shell ( Shell parent , int style ) { } public static Shell wpf_new ( Display display , int handle ) { } public static Shell internal_new ( Display display , int handle ) { } static int checkStyle ( int style ) { } public void addShellListener ( ShellListener listener ) { } void addWidget ( ) { } void bringToTop ( ) { } void checkOpen ( ) { } public void close ( ) { } void createHandle ( ) { } void createWidget ( ) { } public Rectangle computeTrim ( int x , int y , int width , int height ) { } void deregister ( ) { } void destroyWidget ( ) { } public void dispose ( ) { } Control findBackgroundControl ( ) { } Control findThemeControl ( ) { } public void forceActive ( ) { } public int getAlpha ( ) { } public Rectangle getBounds ( ) { } public boolean getFullScreen ( ) { } public int getImeInputMode ( ) { } public Point getLocation ( ) { } public boolean getMaximized ( ) { } public Point getMinimumSize ( ) { } public Region getRegion ( ) { } public Shell getShell ( ) { } public boolean getVisible ( ) { } public Shell [ ] getShells ( ) { } Composite findDeferredControl ( ) { } public boolean isEnabled ( ) { } void hookEvents ( ) { } void HandleActivated ( int sender , int e ) { } void HandleClosed ( int sender , int e ) { } void HandleClosing ( int sender , int e ) { if ( ! ( checkEvent ( e ) ) ) return ; closing = true ; boolean doit = false ; <START_BUG> if ( ( isEnabled ( ) ) && ( isActive ( ) ) ) { <END_BUG> Event event = new Event ( ) ; sendEvent ( Close , event ) ; doit = ( event . doit ) || ( isDisposed ( ) ) ; } if ( doit ) { if ( ( shellHandle ) != 0 ) OS . Window_Owner ( shellHandle , 0 ) ; if ( ! ( isDisposed ( ) ) ) release ( false ) ; } else { OS . CancelEventArgs_Cancel ( e , true ) ; } closing = false ; } void HandleDeactivated ( int sender , int e ) { } void HandleLocationChanged ( int sender , int e ) { } void HandleLostKeyboardFocusDeactivate ( int sender , int e ) { } void HandleMouseLeave ( int sender , int e ) { } void HandlePreviewGotKeyboardFocusActivate ( int sender , int e ) { } void HandleSizeChanged ( int sender , int e ) { } public void open ( ) { } void register ( ) { } void releaseChildren ( boolean destroy ) { } void releaseHandle ( ) { } void releaseParent ( ) { } void releaseWidget ( ) { } public void removeShellListener ( ShellListener listener ) { } public void setActive ( ) { } void setActiveControl ( Control control ) { } public void setAlpha ( int alpha ) { } int setBounds ( int x , int y , int width , int height , int flags ) { } void setClipping ( ) { } public void setEnabled ( boolean enabled ) { } public void setFullScreen ( boolean fullScreen ) { } public void setImeInputMode ( int mode ) { } public void setMinimumSize ( int width , int height ) { } public void setMinimumSize ( Point size ) { } void setParent ( ) { } public void setRegion ( Region region ) { } public void setVisible ( boolean visible ) { } int topHandle ( ) { } boolean traverseEscape ( ) { } void updateModal ( ) { } }

Fix:
if ( isEnabled ( ) ) {