>>finalize questions
Bert Freudenberg
bert at impara.de
Sun Aug 27 11:15:23 UTC 2006
Am 27.08.2006 um 06:50 schrieb Michael van der Gulik:
> Bert Freudenberg wrote:
>> Michael van der Gulik schrieb:
>>> Bert Freudenberg wrote:
>>>
>>>> Michael van der Gulik schrieb:
>>>
>>> I'd like to confirm that my approach indeed doesn't work, even if
>>> I stick a 'Smalltalk garbageCollect' in the middle of it. Argh.
>> You should try to trace the non-GCed instance of TestPoller. My
>> guess would be that it is still referenced by the #startPolling:
>> method context which is referenced by the process that executes
>> the block you forked.
>
> You are right. In fact, the strong reference was sitting right
> there in front of me as a method parameter (/me slaps forehead).
>
> For completeness, a working version of the code is attached.
Well, this line
((w at: 1) isNil) ifTrue: [keepPolling := false] ifFalse: [ (w at:
1) poll ].
is incorrect - a GC might well happen between the #isNil check and
the #poll send, so the weak ref might have become nil by the time you
send #poll.
- Bert -
More information about the Squeak-dev
mailing list
|