DeepCopier fix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

DeepCopier fix

Stéphane Rollandin
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 ?

(fix attached)


Stef



DeepCopier-fixDependents.st (718 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: DeepCopier fix

Stéphane Rollandin
> I'm sending here a fix here

Doh.


Reply | Threaded
Open this post in threaded view
|

Re: DeepCopier fix

Chris Muller-3
In reply to this post by Stéphane Rollandin
On Tue, Dec 2, 2014 at 2:37 PM, Stéphane Rollandin
<[hidden email]> 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
>
>
>