#BUGFIX by cg
class: WeakIdentityDictionary
changed: #clearDeadSlots
allow observing, by sending out a change message.
--- 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"
!