>When I look at SkinnableTextBase.partAdded it looks like it is adding a >listener to the 'textDisplay'. I assume that 'textDisplay' isn't a StageText >in a pool. If that's true, >the SkinnableTextBase.as is correct. >I would expect that 'textDisplay' is a StageTextInputSkin and internally it >should be adding weak reference listeners to the actual StageText's in the >pool. Or are those >bad assumptions?
It's a little trickier than that, because StageText itself is wrapped in a ScrollableStageText (or StyleableStageText depending on the skin) So SkinnableTextBase.textDisplay is the ScrollableStageText which is a (pooled) wrapper around StageText. And the pool has two static dictionaries ( SST => ST and ST => SST). So seeting the listeners on the SST locks the TI, because the SST are also referenced in the pool dictionary. Makes sense to you? Maurice -----Message d'origine----- De : Alex Harui [mailto:aha...@adobe.com] Envoyé : mardi 22 avril 2014 19:20 À : dev@flex.apache.org Objet : Re: Question about mobile StageText pool On 4/22/14 10:07 AM, "Maurice Amsellem" <maurice.amsel...@systar.com> wrote: >>so detaching skins does not have to be part of the lifecycle. >I agree with that, that's why I was asking about removing listeners, >rather than detaching skins. Is that the same ? >IOW, do you mean that explicitly removing listeners from the skin to >the component shouldn't be part of the component lifecycle, and all >rely on GC ? Either way, there is no good event/trigger to use to know when to remove listeners or detach skins so I would not make it part of the lifecycle. > >> Isn't the solution as simple as using weak reference listeners to the >>stagetext events? >Yes, it's probably that simple ( I have to check yet). >But the events are not set in the skins, they are set in the component >(SkinnableTextBase.partAdded / partRemoved). >So doing it that way bothers me because the component is not supposed >to know about the internals of the skins (pooling , or whatever). >So setting weak listeners in the component because we KNOW that the >skin is using a pool defeats that principle. > >But maybe I am too "purist" ;-) When I look at SkinnableTextBase.partAdded it looks like it is adding a listener to the 'textDisplay'. I assume that 'textDisplay' isn't a StageText in a pool. If that's true, the SkinnableTextBase.as is correct. I would expect that 'textDisplay' is a StageTextInputSkin and internally it should be adding weak reference listeners to the actual StageText's in the pool. Or are those bad assumptions? -Alex >