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 content
Date Sat, 13 Aug 2016 12:02:21 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 12:01 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}


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). 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 content
> --------------------------------------------------------------------
>
>                 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: SpecifiableListWrapper.as, SpecifiableListWrapperHorizontalSkin.mxml
>
>
> In some very specific cases `ConstraintLayout` will throw a nullpointer 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 a nullpointer 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.
> Here is some code to reproduce the error consistently. My apologies for the complexity,
but I couldn't get a simpler example to trigger the error.
>     <s:Group width="100%">
>         <s:layout>
>             <s:ConstraintLayout>
>                 <s:constraintColumns>
>                     <s:ConstraintColumn id="sequenceCol"/>
>                     <s:ConstraintColumn id="labelCol"/>
>                     <s:ConstraintColumn id="contentCol" width="100%"/>
>                     <s:ConstraintColumn id="helpCol" maxWidth="200"/>
>                 </s:constraintColumns>
>                 <s:constraintRows>
>                     <s:ConstraintRow id="row1" baseline="maxAscent:10" height="100%"/>
>                 </s:constraintRows>
>             </s:ConstraintLayout>
>         </s:layout>
>         <s:Group left="contentCol:0" right="contentCol:1" baseline="row1:0" bottom="row1:10">
>             <t:SpecifiableListWrapper width="100%" skinClass="SpecifiableListWrapperHorizontalSkin">
>                 <s:DropDownList dataProvider="{dp}"/>
>             </t:SpecifiableListWrapper>
>         </s:Group>
>         <s:Group id="helpContentGroup" left="helpCol:27" right="helpCol:10" bottom="row1:10"
baseline="row1:0"/>
>     </s:Group>
> As you may notice, the constraint columns and rows are a copy of those used in FormItemSkin.
I left only the content columns necessary to trigger the error (yup, remove the `helpContentGroup`
and the error's gone). SpecifiableListWrapper is a custom component which I will attach, along
with the specific skin that has the Transition that triggers the error.
> Workaround: subclass ConstraintLayout (or FormItemLayout), override `measure()`, put
a try/cacth block around it and use this custom layout.
> public class FormItemLayout extends spark.layouts.FormItemLayout {
>     override public function measure():void {
>         try {
>             super.measure();
>         }
>         catch (e:Error) { }
>     }
> }
> 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 >
> if (rowBaselines && rowBaselines[bIndex][1]) ...
> instead of 
> if (rowBaselines[bIndex][1]) ...



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

Mime
View raw message