[Pharo-project] FreeType and finalization

Igor Stasenko siguctua at gmail.com
Tue Oct 12 13:07:48 EDT 2010


In Pharo-INBOX

Name: FreeType-Igor_Stasenko.536
Author: Igor.Stasenko
Time: 12 October 2010, 8:07:50 pm
UUID: fa9746fa-e253-7948-8bab-799ea9fba754
Ancestors: FreeType-StephaneDucasse.535

- removed weak registry subclass,
but preserving the same semantics as before (guard against duplicating handles)

On 12 October 2010 18:19, Stéphane Ducasse <stephane.ducasse at inria.fr> wrote:
> yes
>
>
> On Oct 12, 2010, at 4:51 PM, Gary Chambers wrote:
>
>> Is in core now I believe.
>>
>> Regards, Gary
>>
>> ----- Original Message ----- From: "Igor Stasenko" <siguctua at gmail.com>
>> To: <Pharo-project at lists.gforge.inria.fr>
>> Sent: Tuesday, October 12, 2010 2:29 PM
>> Subject: Re: [Pharo-project] FreeType and finalization
>>
>>
>>> 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 at btinternet.com> wrote:
>>>> Indeed... never seen that error hence proposal for simplest solution.
>>>>
>>>> Regards, Gary
>>>>
>>>> ----- Original Message ----- From: "Igor Stasenko" <siguctua at gmail.com>
>>>> To: <Pharo-project at 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 at 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 at lists.gforge.inria.fr
>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> Pharo-project at lists.gforge.inria.fr
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Igor Stasenko AKA sig.
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> Pharo-project at lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list