[Pharo-project] FreeType and finalization
siguctua at gmail.com
Tue Oct 12 08:21:14 EDT 2010
2010/10/12 Gary Chambers <gazzaguru2 at btinternet.com>:
> Hi all, I've encountered a problem with FreeType with respect to the new
> finalization scheme.
> Regards, Gary
FT2HandleRegistry overrides following method:
"Add anObject to the receiver. Store the object as well as the
| executor dup |
executor := anObject executor.
dup := nil.
dup := valueDictionary detect: [ :v | v handle = executor handle ]
ifNone: [ ].
valueDictionary at: anObject put: executor.
dup ifNotNil: [ self error: 'Duplicate object added!'. self remove: 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 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.
Igor Stasenko AKA sig.
More information about the Pharo-dev