[squeak-dev] DeepCopier fix

Chris Muller asqueaker at gmail.com
Tue Dec 2 22:27:18 UTC 2014


On Tue, Dec 2, 2014 at 2:37 PM, Stéphane Rollandin
<lecteur at zogotounga.net> wrote:
> Hello,
>
> I'm sending here a fix here for method DeepCopier>>fixDependents, which did
> not check that some weak associations may have a nil key. I have just got
> bitten by the bug, and the fix seemed straightforward.
>
> Now I did not investigate further, but maybe the test for nil keys should be
> moved to a specific implementation of #associationsDo: in
> WeakIdentityKeyDictionary.
>
> What do you think ?

Seems like the nil check should be in
WeakIdentityKeyDictionary>>#associationsDo:.  If its key has been
collected it should not be enumerated.

But you know I cannot stand how veryDeepCopy calls fixDependents even
when it doesn't need to.  DependentsFields can get quite large, and
it's so horrendously slow that I've actually overridden #veryDeepCopy
in a few classes with identical code except with that line removed.  I
wish there were an easy way for callers of #veryDeepCopy to specify
whether to do it..

>
> (fix attached)
>
>
> Stef
>
>
>


More information about the Squeak-dev mailing list