flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mihai Chira (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (FLEX-33311) Nullpointer in ConstraintLayout when executing Transition on DropDownList
Date Sat, 13 Aug 2016 16:34:20 GMT

    [ https://issues.apache.org/jira/browse/FLEX-33311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15419887#comment-15419887
] 

Mihai Chira edited comment on FLEX-33311 at 8/13/16 4:33 PM:
-------------------------------------------------------------

The bug is still reproducible in Apache Flex 4.15 when one selects an item in the DropDownList,
then clicks the list while it's in transition (achieved when clicked very quickly after a
click to open / close it). That, or when the item is selected while the DropDownList is still
in its opening transition. The error is:
{noformat}
[Fault] exception, information=TypeError: Error #1009: Cannot access a property or method
of a null object reference.
at spark.layouts::ConstraintLayout/parseElementConstraints()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/layouts/ConstraintLayout.as:1819]
at spark.layouts::ConstraintLayout/parseConstraints()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/layouts/ConstraintLayout.as:1640]
at spark.layouts::ConstraintLayout/measure()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/layouts/ConstraintLayout.as:422]
at spark.components.supportClasses::GroupBase/measure()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as:1156]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/core/UIComponent.as:9038]
at mx.core::UIComponent/validateSize()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/core/UIComponent.as:8962]
at spark.components::Group/validateSize()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/Group.as:1074]
at mx.managers::LayoutManager/validateSize()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/managers/LayoutManager.as:673]
at mx.managers::LayoutManager/doPhasedInstantiation()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/managers/LayoutManager.as:824]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/managers/LayoutManager.as:1188]
{noformat}

*Debugging info*:
* {{LayoutManager.validateSize()}} ends up calling {{ConstraintLayout.measure()}}, as it should.
At the start of it the {{rowBaselines}} are created (via {{parseConstraints()}}), used and
then cleared (via {{clearConstraintCache()}}.
* {{ConstraintLayout.measure() -> parseConstraints() -> parseElementConstraints()}}
unwittingly triggers an entire validation cycle due to {{Group.get baselinePosition() ->
UIComponent.validateBaselinePosition() -> LayoutManager.validateClient()}}.
* Problem: once this inner validation cycle completes, inside {{LayoutManager.updateCompleteQueue}}
there is also the DropDownList (added there correctly via the outer validation cycle). As
a result, it receives the {{FlexEvent.UPDATE_COMPLETE}} event from {{LayoutManager}}, which,
according to the logic in {{DropDownListBase.close_updateCompleteHandler()}}, closes the list.
* This, in turn, triggers yet another validation cycle.
* When these two inner cycles complete, the outer-most validation is still inside the final
{{for}} loop in {{ConstraintLayout.measure() -> parseConstraints()}}, having just finished
{{parseElementConstraints()}} for the first group. So now is the turn for the second group
(id == "helpContentGroup") to be parsed. But since the inner validation cycles (detailed above)
have ended, they have also cleared the {{rowBaselines}} via {{ConstraintLayout.updateDisplayList()
-> layoutContent() -> clearConstraintCache()}}. Meaning that when {{parseElementConstraints()}}
tries to access them, they're null, and thus the fatal is thrown.


was (Author: evolverine):
The bug is still reproducible in Apache Flex 4.15 when one selects an item in the DropDownList,
then clicks the list while it's in transition (achieved when clicked very quickly after a
click to open / close it). That, or when the item is selected while the DropDownList is still
in its opening transition. The error is:
{noformat}
[Fault] exception, information=TypeError: Error #1009: Cannot access a property or method
of a null object reference.
at spark.layouts::ConstraintLayout/parseElementConstraints()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/layouts/ConstraintLayout.as:1819]
at spark.layouts::ConstraintLayout/parseConstraints()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/layouts/ConstraintLayout.as:1640]
at spark.layouts::ConstraintLayout/measure()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/layouts/ConstraintLayout.as:422]
at spark.components.supportClasses::GroupBase/measure()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as:1156]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/core/UIComponent.as:9038]
at mx.core::UIComponent/validateSize()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/core/UIComponent.as:8962]
at spark.components::Group/validateSize()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/Group.as:1074]
at mx.managers::LayoutManager/validateSize()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/managers/LayoutManager.as:673]
at mx.managers::LayoutManager/doPhasedInstantiation()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/managers/LayoutManager.as:824]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/managers/LayoutManager.as:1188]
{noformat}

> Nullpointer in ConstraintLayout when executing Transition on DropDownList
> -------------------------------------------------------------------------
>
>                 Key: FLEX-33311
>                 URL: https://issues.apache.org/jira/browse/FLEX-33311
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: Layout, Transitions
>    Affects Versions: Apache Flex 4.8 (parity release)
>            Reporter: Maxime Cowez
>            Assignee: Mihai Chira
>             Fix For: Apache Flex 4.9.0
>
>         Attachments: Main.mxml, SpecifiableListWrapper.as, SpecifiableListWrapperHorizontalSkin.mxml
>
>
> In some very specific cases {{ConstraintLayout}} will throw a null pointer error when
a component inside it is playing a transition. I tried a few things and found out that:
> * {{parseConstraints()}} creates a new {{rowBaselines}} Vector (or empties it if it exists)
> * some other process calls {{clearConstraintCache()}} in the middle of the execution
of {{parseConstraints()}}, setting {{rowBaselines}} back to {{null}}
> * {{parseConstraints()}} calls {{parseElementConstraints()}} which tries to access elements
in {{rowBaselines}} and throws the error
> I know very little about how Effects and Transitions work, so the "some other process"
part is a bit of a mistery to me.
> *Steps to reproduce*:
> # Compile and run Main.mxml
> # Select the first item in the list
> # Click on the list and, before the resize transition finishes, click on it again.
> *Workaround*: subclass ConstraintLayout (or FormItemLayout), override `measure()`, put
a try/cacth block around it and use this custom layout. Not exactly pretty but it works without
apparent side effects.
> *Quick fix* (but probably not the ideal solution): just test whether {{rowBaselines}}
exists before trying to access it in {{ConstraintLayout.parseElementConstraints()}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message