flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Mclean (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-33913) XMLListCollection addItem(item) modifies a parent XMLList of the item
Date Fri, 03 Jan 2014 06:33:51 GMT

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

Justin Mclean commented on FLEX-33913:
--------------------------------------

This also works:
for (var i:int=0; i < mainXML.item.length; i++)	{ 
	some.addItem(mainXML.item[i]); 
} 

> XMLListCollection addItem(item) modifies a parent XMLList of the item
> ---------------------------------------------------------------------
>
>                 Key: FLEX-33913
>                 URL: https://issues.apache.org/jira/browse/FLEX-33913
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: .Unspecified - Framework
>    Affects Versions: Adobe Flex SDK 3.6 (Release), Adobe Flex SDK 4.1 (Release), Apache
Flex 4.11.0
>         Environment: Reproduced with the SDKs above in FP 11.9 on Windows IE; Likely
an issue in all OS/SDK/FP combinations.
>            Reporter: Stepan Hilbert
>              Labels: easytest
>
> Sample code:
> {noformat}
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
> 	<mx:Script>
> 		<![CDATA[
> 			import mx.collections.XMLListCollection;
> 			import mx.controls.Alert;
> 			protected var mainXML:XML = 
> 				<root>
> 					<item id="1"/>
> 					<item id="2"/>
> 					<item id="3"/>
> 				</root>;
> 			
> 			protected function addButton_clickHandler(event:MouseEvent):void
> 			{
> 				trace("Length before adding: " + mainXML.item.length()); // traces '3'
> 				var some:XMLListCollection = new XMLListCollection();
> 				for each (var o:Object in mainXML.item)	{
> 					some.addItem(o);
> 				}
> 				trace("Length After adding: " + mainXML.item.length()); // traces '5' BUT SHOULD
BE STILL 3
> 			}
> 		]]>
> 	</mx:Script>
> 	<mx:Button label="Add Items" click="addButton_clickHandler(event)" />
> </mx:Application>
> {noformat}
> Result:
> mainXML.item XMLList is gets modified - the 2nd and 3rd items are added to it. That shouldn't
happen and can cause very severe issues.
> Workaround:
> Do not use XMLListCollection. Array or ArrayCollection seem to be unaffected by this
bug.
> Related Issues:
> This issue might share the same underlying cause: FLEX-21831



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message