Buggy code:
public class PerspectiveHelper { private WorkbenchPage page ; private Perspective perspective ; private Composite parentWidget ; private ViewSashContainer mainLayout ; private ArrayList detachedWindowList = new ArrayList ( 1 ) ; private ArrayList detachedPlaceHolderList = new ArrayList ( 1 ) ; private boolean detachable = false ; private boolean active = false ; private static final int MIN_DETACH_WIDTH = 150 ; private static final int MIN_DETACH_HEIGHT = 250 ; protected PerspectiveHelper . ActualDropTarget dropTarget ; private IDragOverListener dragTarget = new IDragOverListener ( ) { public IDropTarget drag ( Control currentControl , Object draggedObject , Point position , final Rectangle dragRectangle ) { } } ; private final class ActualDropTarget extends AbstractDropTarget { private LayoutPart part ; private Rectangle dragRectangle ; private ActualDropTarget ( LayoutPart part , Rectangle dragRectangle ) { } private void setTarget ( LayoutPart part , Rectangle dragRectangle ) { } public void drop ( ) { } public Cursor getCursor ( ) { } } private class MatchingPart implements Comparable { String pid ; String sid ; LayoutPart part ; boolean hasWildcard ; int len ; MatchingPart ( String pid , String sid , LayoutPart part ) { } public int compareTo ( Object a ) { } } public PerspectiveHelper ( WorkbenchPage workbenchPage , ViewSashContainer mainLayout , Perspective perspective ) { } public void activate ( Composite parent ) { } public void addPart ( LayoutPart part ) { } public void attachPart ( IViewReference ref ) { } public boolean canDetach ( ) { } public boolean bringPartToTop ( LayoutPart part ) { } public boolean isPartVisible ( IWorkbenchPartReference partRef ) { } public boolean willPartBeVisible ( String partId ) { } public boolean willPartBeVisible ( String partId , String secondaryId ) { } private PartPlaceholder [ ] collectPlaceholders ( ) { } private PartPlaceholder [ ] collectPlaceholders ( LayoutPart [ ] parts ) { } public void collectViewPanes ( List result ) { } private void collectViewPanes ( List result , LayoutPart [ ] parts ) { } public void deactivate ( ) { } public void dispose ( ) { } public void describeLayout ( StringBuffer buf ) { } void derefPart ( LayoutPart part ) { if ( part instanceof ViewPane ) { IViewReference ref = ( ( ViewPane ) ( part ) ) . getViewReference ( ) ; if ( perspective . isFastView ( ref ) ) { String id = perspective . getFastViewManager ( ) . getIdForRef ( ref ) ; LayoutPart parentPart = findPart ( id , null ) ; if ( parentPart instanceof ContainerPlaceholder ) { ViewStack vs = ( ( ViewStack ) ( ( ( ContainerPlaceholder ) ( parentPart ) ) . getRealContainer ( ) ) ) ; LayoutPart [ ] kids = vs . getChildren ( ) ; for ( int i = 0 ; i < ( kids . length ) ; i ++ ) { if ( ( kids [ i ] ) instanceof PartPlaceholder ) { if ( ref . getId ( ) . equals ( kids [ i ] . id ) ) vs . remove ( kids [ i ] ) ; } } } <START_BUG> perspective . getFastViewManager ( ) . removeViewReference ( ref , false , true ) ; <END_BUG> } } ILayoutContainer oldContainer = part . getContainer ( ) ; boolean wasDocked = part . isDocked ( ) ; Shell oldShell = part . getShell ( ) ; part . reparent ( mainLayout . getParent ( ) ) ; if ( oldContainer == null ) { return ; } oldContainer . remove ( part ) ; LayoutPart [ ] children = oldContainer . getChildren ( ) ; if ( wasDocked ) { boolean hasChildren = ( children != null ) && ( ( children . length ) > 0 ) ; if ( hasChildren ) { int childVisible = 0 ; for ( int i = 0 ; i < ( children . length ) ; i ++ ) { if ( ( children [ i ] . getControl ( ) ) != null ) { childVisible ++ ; } } if ( oldContainer instanceof ViewStack ) { ViewStack folder = ( ( ViewStack ) ( oldContainer ) ) ; boolean inTrim = ( perspective . getFastViewManager ( ) . getFastViews ( folder . getID ( ) ) . size ( ) ) > 0 ; if ( ( childVisible == 0 ) && ( ! inTrim ) ) { 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 ( ) ; } } } } else if ( ! wasDocked ) { if ( ( children == null ) || ( ( children . length ) == 0 ) ) { DetachedWindow w = ( ( DetachedWindow ) ( oldShell . getData ( ) ) ) ; oldShell . close ( ) ; detachedWindowList . remove ( w ) ; } else { boolean allInvisible = true ; for ( int i = 0 , length = children . length ; i < length ; i ++ ) { if ( ! ( ( children [ i ] ) instanceof PartPlaceholder ) ) { allInvisible = false ; break ; } }

Fix:
perspective . getFastViewManager ( ) . removeViewReference ( ref , true , true ) ;