Buggy code:
public class Project implements Serializable { public static final String SEPARATOR = "//" ; public static final String COMPRESSED_FILE_EXT = ".zargo" ; public static final String UNCOMPRESSED_FILE_EXT = ".argo" ; public static final String PROJECT_FILE_EXT = ".argo" ; public static final String TEMPLATES = "//org//argouml//templates//" ; public static String ARGO_TEE = "//org//argouml//xml//dtd//argo.tee" ; public static final String UNTITLED_FILE = "Untitled" ; protected static OCLExpander expander = null ; private URL _url = null ; protected ChangeRegistry _saveRegistry ; public String _authorname = "" ; public String _description = "" ; public String _version = "" ; public Vector _searchpath = new Vector ( ) ; public Vector _members = new Vector ( ) ; public String _historyFile = "" ; public Vector _models = new Vector ( ) ; public Vector _diagrams = new Vector ( ) ; public boolean _needsSave = false ; public MNamespace _curModel = null ; public Hashtable _definedTypes = new Hashtable ( 80 ) ; public HashMap _UUIDRefs = null ; public GenerationPreferences _cgPrefs = new GenerationPreferences ( ) ; public transient VetoableChangeSupport _vetoSupport = null ; public static Category cat = Category . getInstance ( Project . class ) ; public Project ( File file ) throws IOException , MalformedURLException { } public Project ( URL url ) { } public Project ( ) { } public Project ( MModel model ) { } public static Project loadProject ( URL url ) throws IOException , Exception { } public MModel loadModelFromXMI ( URL url ) throws IOException { } public void loadZippedProjectMembers ( URL url ) throws PropertyVetoException , IOException { } public static Project makeEmptyProject ( ) { } public String getBaseName ( ) { } public String getName ( ) { } public void setName ( String n ) throws PropertyVetoException , MalformedURLException { } public URL getURL ( ) { } public void setURL ( URL url ) throws PropertyVetoException { } public void setFile ( File file ) throws PropertyVetoException { } public Vector getSearchPath ( ) { } public void addSearchPath ( String searchpath ) { } public URL findMemberURLInSearchPath ( String name ) { } public Vector getMembers ( ) { } public void addMember ( String name , String type ) { } public void addMember ( ArgoDiagram d ) throws PropertyVetoException { } public void addMember ( MModel m ) throws PropertyVetoException { } public void addModel ( MNamespace m ) throws PropertyVetoException { } protected void removeProjectMemberDiagram ( ArgoDiagram d ) { } public ProjectMember findMemberByName ( String name ) { } public static Project load ( URL url ) throws IOException , SAXException { } public void loadMembersOfType ( String type ) { } public void loadAllMembers ( ) { } public void save ( boolean overwrite , File file ) throws IOException { } public String getAuthorname ( ) { } public void setAuthorname ( String s ) { } public String getVersion ( ) { } public void setVersion ( String s ) { } public String getDescription ( ) { } public void setDescription ( String s ) { } public String getHistoryFile ( ) { } public void setHistoryFile ( String s ) { } public void setNeedsSave ( boolean newValue ) { } public boolean needsSave ( ) { } public Vector getModels ( ) { } public MNamespace getModel ( ) { } public Vector getDefinedTypesVector ( ) { } public Hashtable getDefinedTypes ( ) { } public void setDefinedTypes ( Hashtable h ) { } public void defineType ( MClassifier cls ) { } public MClassifier findType ( String s ) { } public Collection findFigsForMember ( Object member ) { } public MClassifier findTypeInModel ( String s , MNamespace ns ) { } public void setCurrentNamespace ( MNamespace m ) { } public MNamespace getCurrentNamespace ( ) { } public Vector getDiagrams ( ) { } public void addDiagram ( ArgoDiagram d ) throws PropertyVetoException { } protected void removeDiagram ( ArgoDiagram d ) throws PropertyVetoException { } public int getPresentationCountFor ( MModelElement me ) { } public Object getInitialTarget ( ) { } public void setGenerationPrefs ( GenerationPreferences cgp ) { } public GenerationPreferences getGenerationPrefs ( ) { } public void addVetoableChangeListener ( VetoableChangeListener l ) { } public void removeVetoableChangeListener ( VetoableChangeListener l ) { } public VetoableChangeSupport getVetoSupport ( ) { } public void preSave ( ) { } public void postSave ( ) { } public void postLoad ( ) { } public void moveToTrash ( Object obj ) { } protected void trashInternal ( Object obj ) { boolean needSave = false ; if ( obj instanceof MModelElement ) { TheInstance . getEditorPane ( ) . removePresentationFor ( obj , getDiagrams ( ) ) ; <START_BUG> SINGLETON . remove ( ( ( MModelElement ) ( obj ) ) ) ; <END_BUG> if ( _members . contains ( obj ) ) { _members . remove ( obj ) ; } if ( _models . contains ( obj ) ) { _models . remove ( obj ) ; } needSave = true ; } else { if ( obj instanceof ArgoDiagram ) { removeProjectMemberDiagram ( ( ( ArgoDiagram ) ( obj ) ) ) ; needSave = true ; } } setNeedsSave ( needSave ) ; } public void moveFromTrash ( Object obj ) { } public boolean isInTrash ( Object dm ) { } public static void resetStats ( ) { } public static void setStat ( String n , int v ) { } public static Vector getStats ( ) { } public static void addStat ( Vector stats , String name , int value ) { } static final long serialVersionUID = 1399111233978692444L ; }

Fix:
UmlFactory . getFactory ( ) . remove ( ( ( MModelElement ) ( obj ) ) ) ;