flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frédéric THOMAS (JIRA) <j...@apache.org>
Subject [jira] [Assigned] (FLEX-34611) Application crash when textFlow property set to null with preserveSelection
Date Fri, 24 Oct 2014 14:44:34 GMT

     [ https://issues.apache.org/jira/browse/FLEX-34611?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Frédéric THOMAS reassigned FLEX-34611:
--------------------------------------

    Assignee: Frédéric THOMAS

> Application crash when textFlow property set to null with preserveSelection
> ---------------------------------------------------------------------------
>
>                 Key: FLEX-34611
>                 URL: https://issues.apache.org/jira/browse/FLEX-34611
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: RichEditableText
>            Reporter: dimitri kara
>            Assignee: Frédéric THOMAS
>              Labels: RichEditableText, tlf
>
> In the TextContainerManager class, the setText method has this starting code:
> {quote}
> 	public function setText(text:String):void
> 		{
> 			var hadPreviousSelection:Boolean = false;
> 			var selectionChanged:Boolean = false;
> 			var selectionState:SelectionState = null;
>             
>             var oldAnchorPosition:int = -1;
>             var oldActivePosition:int = -1;
>             
> 			if (_sourceState == SOURCE_TEXTFLOW)
> 			{
> 				if (_textFlow.interactionManager && _textFlow.interactionManager.hasSelection()){
> 					hadPreviousSelection = true;
> 					
> 					//preserve the selection state 
> 					*if (_preserveSelectionOnSetText)*
>   {   
>   oldAnchorPosition = Math.min(_textFlow.interactionManager.anchorPosition, *text.length*);
>                         oldActivePosition = Math.min(_textFlow.interactionManager.activePosition,
text.length);      					
>         ...
> 	{quote}			
> The problem is the fact that when a RichEditableText has its textFlow property set to
null, the TextContainerManager class make this call:
> *setText(null);*
> Then, if _preserveSelectionOnSetText is true, we have a null object reference error because
of line #583
> *oldAnchorPosition = Math.min(_textFlow.interactionManager.anchorPosition, text.length);*
> with the text variable equal to null
> The problem is worse in debug, because each time the error is thrown the app lose focus
because of the debugger, and the error is thrown again because of the activate event when
the app regain focus, resulting in crash or unusable app.
> The solution seems quite simple: check that text is not null before trying to restore
selection.
> line 581 would be:
> 		*if (_preserveSelectionOnSetText && text)*



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

Mime
View raw message