#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Tue, 01 Nov 2016 13:30:18 +0100
changeset 20702 5dfa0631a814
parent 20701 32a0109f2ccb
child 20703 d7634ffa200f
#BUGFIX by cg class: WeakIdentityDictionary changed: #clearDeadSlots allow observing, by sending out a change message.
WeakIdentityDictionary.st
--- a/WeakIdentityDictionary.st	Tue Nov 01 13:29:51 2016 +0100
+++ b/WeakIdentityDictionary.st	Tue Nov 01 13:30:18 2016 +0100
@@ -213,7 +213,7 @@
 !WeakIdentityDictionary methodsFor:'element disposal'!
 
 clearDeadSlots
-    |wasBlocked|
+    |wasBlocked anyChange|
 
     "
      have to block here - dispose may be done at a low priority
@@ -221,16 +221,21 @@
      higher prio process, the dictionary might get corrupted otherwise
     "
     wasBlocked := OperatingSystem blockInterrupts.
+    anyChange := false.
     [
-	keyArray
-	    forAllDeadIndicesDo:[:idx |
-				    valueArray basicAt:idx put:nil.
-				    tally := tally - 1.
-				]
-	    replacingCorpsesWith:DeletedEntry.
+        keyArray
+            forAllDeadIndicesDo:[:idx |
+                                    valueArray basicAt:idx put:nil.
+                                    tally := tally - 1.
+                                    anyChange := true.
+                                ]
+            replacingCorpsesWith:DeletedEntry.
     ] ensure:[
-	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ].
+    anyChange ifTrue:[
+        self changed:#ElementExpired
+    ].    
 
     "Modified: / 13.12.2001 / 14:18:17 / martin"
 !