Buggy code:
public class PerspectivePresentation { private WorkbenchPage page ; private Composite parentWidget ; private RootLayoutContainer mainLayout ; private IWorkbenchPartReference zoomPart ; private boolean active = false ; private boolean wasFastViewActive = false ; private Map dragParts = new HashMap ( ) ; private IPartDropListener partDropListener ; private static final int MIN_DETACH_WIDTH = 50 ; private static final int MIN_DETACH_HEIGHT = 50 ; public PerspectivePresentation ( WorkbenchPage workbenchPage , RootLayoutContainer mainLayout ) { } public void activate ( Composite parent ) { } public void addPart ( LayoutPart part ) { } public boolean bringPartToTop ( LayoutPart part ) { } public boolean isPartVisible ( String partId ) { } public void openTracker ( ViewPane pane ) { } private void collectDragParts ( List result , LayoutPart [ ] parts ) { } private void collectDropTargets ( List result , LayoutPart [ ] parts ) { } private PartPlaceholder [ ] collectPlaceholders ( ) { } private PartPlaceholder [ ] collectPlaceholders ( LayoutPart [ ] parts ) { } public void collectViewPanes ( List result ) { } private void collectViewPanes ( List result , LayoutPart [ ] parts ) { } public void deactivate ( ) { } private void derefPart ( LayoutPart part ) { Window oldWindow = part . getWindow ( ) ; ILayoutContainer oldContainer = part . getContainer ( ) ; if ( oldContainer == null ) return ; oldContainer . remove ( part ) ; updateContainerVisibleTab ( oldContainer ) ; LayoutPart [ ] children = oldContainer . getChildren ( ) ; if ( oldWindow instanceof WorkbenchWindow ) { boolean hasChildren = ( children != null ) && ( ( children . length ) > 0 ) ; if ( hasChildren ) { int childVisible = 0 ; for ( int i = 0 ; i < ( children . length ) ; i ++ ) <START_BUG> if ( children [ i ] . isVisible ( ) ) <END_BUG> childVisible ++ ; if ( oldContainer instanceof PartTabFolder ) { PartTabFolder folder = ( ( PartTabFolder ) ( oldContainer ) ) ; if ( childVisible == 0 ) { ILayoutContainer parentContainer = folder . getContainer ( ) ; for ( int i = 0 ; i < ( children . length ) ; i ++ ) { folder . remove ( children [ i ] ) ; parentContainer . add ( children [ i ] ) ; } hasChildren = false ; } else if ( childVisible == 1 ) { LayoutTree layout = mainLayout . getLayoutTree ( ) ; layout = layout . find ( folder ) ; layout . setBounds ( layout . getBounds ( ) ) ; } } } if ( ! hasChildren ) { if ( oldContainer instanceof LayoutPart ) { LayoutPart parent = ( ( LayoutPart ) ( oldContainer ) ) ; ILayoutContainer parentContainer = parent . getContainer ( ) ; if ( parentContainer != null ) { parentContainer . remove ( parent ) ; parent . dispose ( ) ; } } } } } private void disableAllDrag ( ) { } void disableDrag ( ViewPane part ) { } public void disposeSashes ( ) { } private void enableAllDrag ( ) { } private void enableAllDrop ( ) { } void enableDrag ( ViewPane part ) { } private void enableDrop ( LayoutPart part ) { } private LayoutPart findPart ( String id ) { } private LayoutPart findPart ( String id , LayoutPart [ ] parts ) { } public boolean hasPlaceholder ( String id ) { } public RootLayoutContainer getLayout ( ) { } public boolean isActive ( ) { } private boolean isFastView ( IWorkbenchPartReference ref ) { } public boolean isZoomed ( ) { } private void makeFast ( LayoutPart part ) { } private void movePart ( LayoutPart part , int position , LayoutPart relativePart ) { } void onPartDragOver ( PartDropEvent e ) { } private void onFastViewIconDrag ( PartDropEvent e ) { } void onPartDrop ( PartDropEvent e ) { } private void moveFastView ( ShortcutBarPart shortcutBarPart , int x , int y ) { } private void reorderFastViews ( ShortcutBarPart shortcutBarPart , IViewReference draggedView , int x , int y ) { } public boolean partChangeAffectsZoom ( PartPane pane ) { } public void removePart ( LayoutPart part ) { } public void replacePlaceholderWithPart ( LayoutPart part ) { } public IStatus restoreState ( IMemento memento ) { } public IStatus saveState ( IMemento memento ) { } private void stack ( LayoutPart part , LayoutPart refPart ) { } private void stackView ( ViewPane newPart , LayoutPart refPart ) { } private void updateContainerVisibleTab ( ILayoutContainer container ) { } public void zoomIn ( IWorkbenchPartReference ref ) { } public void zoomOut ( ) { } }

Fix:
if ( ( children [ i ] . getControl ( ) ) != null )