[ https://issues.apache.org/jira/browse/FLEX-35321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16037044#comment-16037044 ]
Alex Harui commented on FLEX-35321: ----------------------------------- You are not the first person to run into this issue. I'm not sure there is a quick test to prove that a component is on the stage since all Flex apps are constructed off-stage at startup and only placed on the stage after LayoutManager finishes its initial validation. In deeply nested trees of components, you can't just check to see if you have a parent, and walking the parent chain would be too expensive. An alternative plan might be to add APIs to LayoutManager so you could hand it a tree of components and tell it to remove all of these components from the validation queues. It might be best if you tell LayoutManager to remove the components before you remove them from their parent because I think the nestLevel can be used to more quickly determine which queues to search. I think other folks who've run into this before subclassed their components and put defensive code in overrides of the APIs LayoutManager calls on those components. > LayoutManager initializes components which are no longer on stage > ----------------------------------------------------------------- > > Key: FLEX-35321 > URL: https://issues.apache.org/jira/browse/FLEX-35321 > Project: Apache Flex > Issue Type: Bug > Components: Layout - General > Affects Versions: Apache Flex 4.16.0 > Reporter: Mihai Chira > Assignee: Mihai Chira > Fix For: Apache Flex 4.17.0 > > > *Scenario A*: during an object's validation cycle some code resulting from > {{validateSize()}}, {{validateProperties()}} or {{validateDisplayList()}} > results in the object's removal from stage. > *Scenario B*: a user performs an action whose effect is the removal of a > component, exactly when that component is being validated in phases > ({{LayoutManager.usePhasedInstantiation == true}}, which is to say, in the > span of two-three frames. > (For the unit test that models this scenario.) > ---- > *Expected behaviour*: {{LayoutManager}} detects the object's removal from > stage, stops validating it, and never sets its {{initialized}} flag to > {{true}}. > *Actual behaviour*: {{LayoutManager}} does not detect the object's removal > from stage, continues validating it, and ends up setting the object's > {{initialized}} flag to {{true}}. > *Unit test*: {{LayoutManager_FLEX_35321_Tests}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)