[Cuis-dev] Primitive fail when:send:to:withArguments:

Juan Vuletich JuanVuletich at zoho.com
Wed May 25 19:39:22 PDT 2022


Have you taken into account that receiver and arguments of 
#when:send:to: and friends are only held weakly? This means that if 
there is no other (strong) reference to them, they can be garbage 
collected anytime and will become nil. This is not "corruption", but how 
#when:send:to: works. I believe (not absolutely sure) it is the same in 
other Smalltalk dialects.

HTH,

On 5/25/2022 6:43 PM, Hilaire Fernandes via Cuis-dev wrote:
>
> Hi,
>
> I can't make sense of the situation.
>
> From the preference browser:
>
>     * when visiting the #gui category, action map for the drop down
>       list is fine.
>     * when visiting the #programming category, action map for the same
>       drop down lists of other preferences is corrupted (missing
>       arguments).
>
> The used code is the same when browsing these categories.
>
> I commited the code in ui/tools/preferenceBrowser repo with an inspect 
> to observe this difference of behavior:
>
>   visitArrayPreference: aPref
>      | list listMorph |
>      aPref isTypeAClass ifTrue: [^ self visitArrayClassPreference: aPref].
>      listMorph  _ DropDownListMorph
>          model: (list _ ListModel with: aPref type)
>          listGetter: #list
>          indexGetter: #listIndex
>          indexSetter: #listIndex: ::
>          autoDeselect: false;
>          setBalloonText: aPref description.
>      list listIndex: (aPref type indexOf: aPref value).
>      list when: #listSelectionChanged send: #changedList:for: to: self withArguments: {list. aPref}.
>     *  list actionMap inspect.*
>      views at: aPref name capitalized put: listMorph
>   
>
> aPref (missing in some actionMap) is a preference instance, therefore 
> stored in the PreferenceNG class.
>
> I tried to debug, actionmap build up code not easy to understand and 
> then actionMap is not corrupted when executing step by step :-o
>
> Hilaire
>
>
> Le 21/05/2022 à 17:26, Juan Vuletich a écrit :
>> The event system holds receiver and arguments weakly. If there is no 
>> other reference to them, they get garbage collected.
> -- 
> GNU Dr. Geo
> http://drgeo.eu
> http://blog.drgeo.eu


-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
https://independent.academia.edu/JuanVuletich
https://www.researchgate.net/profile/Juan-Vuletich
https://patents.justia.com/inventor/juan-manuel-vuletich
https://twitter.com/JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220525/058bf066/attachment.htm>


More information about the Cuis-dev mailing list