[
https://issues.apache.org/jira/browse/FLEX-33913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Justin Mclean updated FLEX-33913:
---------------------------------
Labels: easytest (was: )
> 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.4#6159)