Karl Ramberg uploaded a new version of EToys to project The Trunk: http://source.squeak.org/trunk/EToys-kfr.330.mcz
==================== Summary ====================
Name: EToys-kfr.330 Author: kfr Time: 26 May 2018, 11:55:21.200868 am UUID: 6d9d29a4-708f-e540-a815-584b7d42115e Ancestors: EToys-mt.329
Player had a send to deprecated Smalltalk>>removeKey:ifAbsent:
=============== Diff against EToys-mt.329 ===============
Item was changed: ----- Method: Player class>>freeUnreferencedSubclasses (in category 'housekeeping') ----- freeUnreferencedSubclasses "Player classes may hold in their class instance variables references to instances of themselves that are housekeepingwise unreachable. This method allows such loops to be garbage collected. This is done in three steps: 1. Remove user-created subclasses from the 'subclasses' set and from Smalltalk. Only remove classes whose name begins with 'Player' and which have no references. 2. Do a full garbage collection. 3. Enumerate all Metaclasses and find those whose soleInstance's superclass is this class. Reset the subclasses set to this set of classes, and add back to Smalltalk." "Player freeUnreferencedSubclasses"
| oldFree candidatesForRemoval class | oldFree := Smalltalk garbageCollect. candidatesForRemoval := self subclasses asOrderedCollection select: [:aClass | (aClass name beginsWith: 'Player') and: [aClass name endsWithDigit]].
"Break all system links and then perform garbage collection." candidatesForRemoval do: [:c | self removeSubclass: c. "Break downward subclass pointers." + Smalltalk globals removeKey: c name ifAbsent: []. "Break binding of global - Smalltalk removeKey: c name ifAbsent: []. "Break binding of global name"]. candidatesForRemoval := nil. Smalltalk garbageCollect. "Now this should reclaim all unused subclasses"
"Now reconstruct system links to subclasses with valid references." "First restore any global references via associations" (Association allSubInstances select: [:assn | (assn key isSymbol) and: [(assn key beginsWith: 'Player') and: [assn key endsWithDigit]]]) do: [:assn | class := assn value. (class isKindOf: self class) ifTrue: [self addSubclass: class. Smalltalk add: assn]]. "Then restore any further direct references, creating new associations." (Metaclass allInstances select: [:m | (m soleInstance name beginsWith: 'Player') and: [m soleInstance name endsWithDigit]]) do: [:m | class := m soleInstance. ((class isKindOf: self class) and: [(Smalltalk includesKey: class name) not]) ifTrue: [self addSubclass: class. Smalltalk at: class name put: class]]. SystemOrganization removeMissingClasses. ^ Smalltalk garbageCollect - oldFree !
packages@lists.squeakfoundation.org