I can modify Freetype to not use subclass of weakregistry, and still guarantee non-duplication. Is Freetype a separate maintained package, or its part of Pharo core? On 12 October 2010 16:25, Gary Chambers <gazzaguru2@btinternet.com> wrote:
Indeed... never seen that error hence proposal for simplest solution.
Regards, Gary
----- Original Message ----- From: "Igor Stasenko" <siguctua@gmail.com> To: <Pharo-project@lists.gforge.inria.fr> Sent: Tuesday, October 12, 2010 1:21 PM Subject: Re: [Pharo-project] FreeType and finalization
2010/10/12 Gary Chambers <gazzaguru2@btinternet.com>:
Hi all, I've encountered a problem with FreeType with respect to the new finalization scheme. http://code.google.com/p/pharo/issues/detail?id=3096 Regards, Gary
FT2HandleRegistry overrides following method:
add: anObject "Add anObject to the receiver. Store the object as well as the associated executor." | executor dup | executor := anObject executor. dup := nil. self protected:[ dup := valueDictionary detect: [ :v | v handle = executor handle ] ifNone: [ ]. valueDictionary at: anObject put: executor. ]. dup ifNotNil: [ self error: 'Duplicate object added!'. self remove: anObject ]. ^anObject
As i see, the intent is to prevent registering a same handle twice, so in own turn, when time will come, a #finalize won't attempt to destroy same handle twice.
The proposed fix (as you wrote in issue tracker)
registry ^Registry ifNil: [ Registry := WeakRegistry new]
appears to fix the problem...
But apparently its not the same as in original. Okay, but since we never seen  the error: 'Duplicate object added!', then i think it may work without it :)
Still, it would be good to know, how handles are created, and what the chances that they could be duplicated.
-- Best regards, Igor Stasenko AKA sig.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.