Buggy code:
for ( int i = 0 ; i < ( folderListeners . length ) ; i ++ ) { folderListeners [ i ] . showList ( e ) ; } if ( ( e . doit ) && ( ! ( isDisposed ( ) ) ) ) { showList ( chevronRect ) ; } return ; } if ( minRect . contains ( x , y ) ) { boolean selected = ( minImageState ) == ( CTabFolder . SELECTED ) ; minImageState = CTabFolder . HOT ; redraw ( minRect . x , minRect . y , minRect . width , minRect . height , false ) ; if ( ! selected ) return ; CTabFolderEvent e = new CTabFolderEvent ( this ) ; e . widget = this ; e . time = event . time ; for ( int i = 0 ; i < ( folderListeners . length ) ; i ++ ) { if ( minimized ) { folderListeners [ i ] . restore ( e ) ; } else { folderListeners [ i ] . minimize ( e ) ; } } return ; } if ( maxRect . contains ( x , y ) ) { boolean selected = ( maxImageState ) == ( CTabFolder . SELECTED ) ; maxImageState = CTabFolder . HOT ; redraw ( maxRect . x , maxRect . y , maxRect . width , maxRect . height , false ) ; if ( ! selected ) return ; CTabFolderEvent e = new CTabFolderEvent ( this ) ; e . widget = this ; e . time = event . time ; for ( int i = 0 ; i < ( folderListeners . length ) ; i ++ ) { if ( maximized ) { folderListeners [ i ] . restore ( e ) ; } else { folderListeners [ i ] . maximize ( e ) ; } } return ; } CTabItem item = null ; if ( single ) { if ( ( selectedIndex ) != ( - 1 ) ) { Rectangle bounds = items [ selectedIndex ] . getBounds ( ) ; if ( bounds . contains ( x , y ) ) { item = items [ selectedIndex ] ; } } } else { for ( int i = 0 ; i < ( items . length ) ; i ++ ) { Rectangle bounds = items [ i ] . getBounds ( ) ; if ( bounds . contains ( x , y ) ) { item = items [ i ] ; } } } if ( item != null ) { if ( item . closeRect . contains ( x , y ) ) { boolean selected = ( item . closeImageState ) == ( CTabFolder . SELECTED ) ; item . closeImageState = CTabFolder . HOT ; redraw ( item . closeRect . x , item . closeRect . y , item . closeRect . width , item . closeRect . height , false ) ; if ( ! selected ) return ; CTabFolderEvent e = new CTabFolderEvent ( this ) ; e . widget = this ; e . time = event . time ; e . item = item ; e . doit = true ; for ( int j = 0 ; j < ( folderListeners . length ) ; j ++ ) { CTabFolder2Listener listener = folderListeners [ j ] ; listener . close ( e ) ; } for ( int j = 0 ; j < ( tabListeners . length ) ; j ++ ) { CTabFolderListener listener = tabListeners [ j ] ; listener . itemClosed ( e ) ; } if ( e . doit ) item . dispose ( ) ; <START_BUG> if ( item . isDisposed ( ) ) { <END_BUG> Display display = getDisplay ( ) ; Point pt = display . getCursorLocation ( ) ; pt = display . map ( null , this , pt . x , pt . y ) ; CTabItem nextItem = getItem ( pt ) ; if ( nextItem != null ) { if ( nextItem . closeRect . contains ( pt ) ) { if ( ( ( nextItem . closeImageState ) != ( CTabFolder . SELECTED ) ) && ( ( nextItem . closeImageState ) != ( CTabFolder . HOT ) ) ) { nextItem . closeImageState = CTabFolder . HOT ; redraw ( nextItem . closeRect . x , nextItem . closeRect . y , nextItem . closeRect . width , nextItem . closeRect . height , false ) ; } } else { if ( ( nextItem . closeImageState ) != ( CTabFolder . NORMAL ) ) { nextItem . closeImageState = CTabFolder . NORMAL ; redraw ( nextItem . closeRect . x , nextItem . closeRect . y , nextItem . closeRect . width , nextItem . closeRect . height , false ) ; } } } } return ; } } } } } boolean onPageTraversal ( Event event ) { } void onPaint ( Event event ) { } void onResize ( ) { } void onTraverse ( Event event ) { } void redrawTabs ( ) { } public void removeCTabFolder2Listener ( CTabFolder2Listener listener ) { } public void removeCTabFolderListener ( CTabFolderListener listener ) { } public void removeSelectionListener ( SelectionListener listener ) { } public void setBackground ( Color color ) { } void setBackground ( Color [ ] colors , int [ ] percents ) { } void setBackground ( Color [ ] colors , int [ ] percents , boolean vertical ) { } void setBackground ( Image image ) { } public void setBorderVisible ( boolean show ) { } void setButtonBounds ( ) { } public void setFont ( Font font ) { } public void setForeground ( Color color ) { } public void setInsertMark ( CTabItem item , boolean after ) { }

Fix:
if ( ( ! ( isDisposed ( ) ) ) && ( item . isDisposed ( ) ) ) {