WeakDependencyDictionary.st
changeset 2101 516fedf50916
parent 2093 3a849047dc90
child 2261 61096f935f76
--- a/WeakDependencyDictionary.st	Thu Jan 09 01:08:05 1997 +0100
+++ b/WeakDependencyDictionary.st	Thu Jan 09 01:31:33 1997 +0100
@@ -85,14 +85,20 @@
                    "/ is it an empty WeakIdSet ?
 
                    (val isMemberOf:WeakIdentitySet) ifTrue:[
-                        val size == 0 ifTrue:[
+                        (t := val size) == 0 ifTrue:[
                             "/ yes - nil it
                             valueArray basicAt:index put:nil.
                             (keyArray basicAt:index) notNil ifTrue:[
                                 keyArray basicAt:index put:DeletedEntry.
                                 tally := tally - 1.
                             ]
-                        ].
+                        ] ifFalse:[
+                            t == 1 ifTrue:[
+                                "/ the set lost an object, and shrunk to size 1
+                                "/ can now use a WeakArray
+                                valueArray basicAt:index put:(WeakArray with:val first)
+                            ]
+                        ]
                     ]
                 ]
             ]
@@ -113,5 +119,5 @@
 !WeakDependencyDictionary class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/WeakDependencyDictionary.st,v 1.1 1997-01-08 23:06:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/WeakDependencyDictionary.st,v 1.2 1997-01-09 00:31:33 cg Exp $'
 ! !