Revert to previous version to stop mustella tests from failing.  Work will 
continue in seperate branch.


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/8ab07475
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/8ab07475
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/8ab07475

Branch: refs/heads/master
Commit: 8ab074753e7c996ac456249b4824eee5e3b3bd01
Parents: f7fdee9
Author: quetwo <[email protected]>
Authored: Sun May 25 10:51:28 2014 -0400
Committer: quetwo <[email protected]>
Committed: Fri Jun 6 14:53:59 2014 -0400

----------------------------------------------------------------------
 .../src/mx/collections/XMLListAdapter.as        | 41 +++++---------------
 1 file changed, 10 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/8ab07475/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as 
b/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
index 5f87f63..17d2173 100644
--- a/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
+++ b/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
@@ -215,10 +215,7 @@ public class XMLListAdapter extends EventDispatcher 
implements IList, IXMLNotifi
     /**
      *  Add the item at the specified index.  Any item that was after
      *  this index is moved out by one.  If the list is shorter than 
-     *  the specified index it will grow to accommodate the new item.
-     *
-     *  The source array may change, and changes made to it may not be
-     *  tracked after this operation if you access it directly.
+     *  the specified index it will grow to accomodate the new item.
      * 
      *  @param item the item to place at the index
      *  @param index the index at which to place the item
@@ -249,36 +246,18 @@ public class XMLListAdapter extends EventDispatcher 
implements IList, IXMLNotifi
                
                setBusy();
 
-        // Replace the current source XMLList with a new list in order to add
-        // the item to the list.  This is needed to maintain the structure of
-        // the new item added to the list and avoid an FP bug.
-
                if (length > 0)
                {
-            var newSource:XMLList = new XMLList();
-
-            for (var i:uint = 0; i <= (length); i++)
-            {
-                if (i < index)
-                {
-                    newSource[i] = source[i];
-                }
-                else if (i == index)
-                {
-                    newSource[i] = item;
-                }
-                else if (i > index)
-                {
-                    newSource[i] = source[i-1];
-                }
-            }
-
-            source = newSource;
+                       var localLength:uint = source.length();
+                       
+                       // Adjust all indexes by 1
+                       for (var i:uint = localLength; i>index; i--)
+                       {
+                               source[i] = source[i - 1];
+                       }
                }
-               else
-        {
-            source[index] = item;
-        }
+               
+               source[index] = item;
 
         startTrackUpdates(item, seedUID + uidCounter.toString());
                uidCounter++;

Reply via email to